0
I have a Select in bank that returns me a number of records, in the case of tax notes, each note of these has N items, and I would like to make a subtable that when it is clicked, list correctly. Today, it is this way (for 1 item works correctly, for more than that, does not displace the second record):
However, when there is more than one item for a certain note, it is getting that way:
How I’d like you to stay:
The HTML is this way (I’m using the MVC standard, I mean the HTML is my View, and for the Model and Controller I’m using C#):
<div class="panel-body">
<table id="example" class="table table-responsive table-hover table-striped" style="width:100%">
<thead>
<tr>
<th class="active">Nota</th>
<th class="active">Serie</th>
<th class="active">Filial</th>
<th class="active">Autorizado</th>
<th class="active">Valor</th>
<th class="active">Xml</th>
<th class="active">Danfe</th>
<th class="active">Itens</th>
</tr>
</thead>
<tbody>
@foreach (var obj in Model.notasLista)
{
<tr class="clickable" data-toggle="collapse" id="@obj.id" data-target="[email protected]">
<td>@obj.nf</td>
<td>@obj.serie</td>
<td>003</td>
<td>@obj.autorizado</td>
<td>R$ @obj.valor</td>
<td><span class="glyphicon glyphicon-download-alt"></span></td>
<td><span class="glyphicon glyphicon-download-alt"></span></td>
<td><span class="glyphicon glyphicon-plus-sign"></span></td>
</tr>
<tr class="collapse @obj.id">
<td class="info" style="width:10%"></td>
<td class="info">Item</td>
<td class="info">Material</td>
<td class="info">Preço</td>
<td class="info">Qtde</td>
<td class="info">Desc\Acresc</td>
<td class="info">Total</td>
</tr>
<tr class="collapse @obj.id">
<td style="width:10%"></td>
@foreach (var tes in Model.itensLista)
{
if (@obj.id.Equals(tes.idItens))
{
<td>@tes.item</td>
<td>@tes.descricaoMaterial</td>
<td>R$ @tes.precoItem</td>
<td>@tes.quantidade</td>
<td>R$ @tes.vlrDescontoAcres</td>
<td>R$ @tes.vlrTotal</td>
}
}
</tr>
}
</tbody>
</table>
</div>
Is there any way to force this line break? Like for example, after walking the 1st line in foreach and so on...
As far as I can remember, there is no "break" in the line between
<tr>
, what you could do is create a new<tr>
and use the attributecolspan
in<td>
to achieve the desired presentation.– Leandro Angelo
@Leandroangelo worked, I’ll post in the comment to you see how it turned out! Thanks =)
– Bruno
Publish the solution as a response.
– Leandro Angelo
Thanks! I’m still new to html so I don’t have much knowledge about tags and how to use them in the best way, slowly improving =)
– Bruno