1
I have a <table>
, and would like to leave the <thead>
of it with fixed top:
<table class="table table-responsive table-hover"
id="tablepesquisaprodutos" style="font-size:12px;">
<thead>
<tr>
<th></th>
<th>Código</th>
<th>Descrição</th>
<th>Qtd</th>
<th>Preço Un.</th>
<th>Desc %</th>
<th>Desc R$</th>
<th>Total</th>
<th>ICMS</th>
<th>Alíquota</th>
<th>V.ICMS</th>
<th>%ISS</th>
<th>V.ISS</th>
<th>%IPI</th>
<th>V.IPI</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.PedidosProdutosF)
{
<tr>
<td><input type="checkbox" class="link-check" onclick="PegaID(@item.Id);" onchange="cbChange(this);" /></td>
<td>@item.CodigoProduto</td>
<td>@item.Produto.nome</td>
<td>@item.Qtd</td>
<td>@item.PrecoUnitario.ToString("N2")</td>
<td>@item.DescontoP.ToString("N2")</td>
<td>@item.DescontoV.ToString("N2")</td>
<td>@item.Total.ToString("N2")</td>
<td>@item.ICMS</td>
<td>@item.Aliquota.ToString("N2")</td>
<td>@item.VICMS.ToString("N2")</td>
<td>@item.ISS.ToString("N2")</td>
<td>@item.VISS.ToString("N2")</td>
<td>@item.IPI.ToString("N2")</td>
<td>@item.VIPI.ToString("N2")</td>
</tr>
}
</tbody>
</table>
But every way I try, he creates a scroll within the table, the fields are misaligned, have some configuration of the bootstrap
to do this, or some other way that works?
Related: It is possible to add an overflow behavior with scroll only in tbody of a table?
– Woss
Other: Fix thead while scrolling table
– Woss
@Andersoncarloswoss already tried this first, but they are misaligned, I will check the others.
– Mariana
And always try to make a [mcve]. Posting HTML with the structure of your template doesn’t make it much easier. Try to generate an HTML that has the actual data by reproducing the problem you mentioned. In this case, you can use the snippet.
– Woss
https://answall.com/questions/141185/tag-thead-fixada-no-topo-e-tbody-com-barra-de-scroll-em-tabela-no-html
– hugocsl
All the ways I try to make an example, the field doesn’t get Responsive, it gets fixed, and I need it to follow the bootstrap pattern.
– Mariana
Mariana as her problem in question was exclusively in Bootstrap I prefer to answer you here than in the other answers cited here. But I will vote to close as duplicate ok, because I understand her as part of the scope of the other questions okay.
– hugocsl