0
在asp.net-core控制器中,我使用BirthDate属性对降序模型集合进行排序,并将其返回给视图。虽然调试准备好的命令是受到尊重的,但是在显示视图表之前将排序方向改为再次升序。Asp .Net Razor查看表默认排序顺序与Bootstrap
是否有一种方法可以在Razor视图中应用Bootstrap类来为表列设置从升序到降序的默认排序顺序?
<table id="table" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Birth date</th>
<th>Name</th>
</tr>
</thead>
<tbody>
@foreach (var person in Model)
{
<tr>
<td>@person.BirthDate</td>
<td>@person.Name</td>
</tr>
}
</tbody>
</table>
什么是最简单的方法来实现它?
引导不支持它。但你可以使用一些插件。 http://tutsme-webdesign.info/bootstrap-3-sortable-table/,https://stackoverflow.com/questions/31888566/bootstrap-how-to-sort-table-columns – Tomato32