我在Razor视图中有一个简单的HTML表
<table id="grid" class="table table-condensed table-hover table-striped">
<tr>
<th data-column-id="Detail">
Detail
</th>
<th data-column-id="Client_Ref">
Client Ref
</th>
<th data-column-id="Acc">
Acc
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.ActionLink(" ", "Detail", new {
id = item.KeyOfTransaction},
new { @class = "btn btn-default glyphicon glyphicon-book" })
</td>
<td>
@Html.DisplayFor(modelItem => item.Client_Ref)
</td>
<td>
@Html.DisplayFor(modelItem => item.Acc)
</td>
</tr>
}
</table>
当我应用JQuery Bootgrid时,仅显示搜索字段,但整个表都为空
@section Scripts {
<script>
$(document).ready(function () {
$("#grid").bootgrid();
})
</script>
}
任何人都知道这里有什么问题吗?我需要过滤数据,对其进行排序,并执行此插件提供的所有其他操作
答案 0 :(得分:0)
bootgrid
插件要求您将表行放入tbody
标记中,并将标题行放入thead
标记中
<table id="grid" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="Detail">
Detail
</th>
<th data-column-id="Client_Ref">
Client Ref
</th>
<th data-column-id="Acc">
Acc
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.ActionLink(" ", "Detail", new {
id = item.KeyOfTransaction},
new { @class = "btn btn-default glyphicon glyphicon-book" })
</td>
<td>
@Html.DisplayFor(modelItem => item.Client_Ref)
</td>
<td>
@Html.DisplayFor(modelItem => item.Acc)
</td>
</tr>
}
</tbody>
</table>
答案 1 :(得分:0)
<thead>
和<tbody>
标签丢失
示例
<table id="grid-basic" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="id" data-type="numeric">ID</th>
<th data-column-id="sender">Sender</th>
<th data-column-id="received" data-order="desc">Received</th>
</tr>
</thead>
<tbody>
<tr>
<td>10238</td>
<td>eduardo@pingpong.com</td>
<td>14.10.2013</td>
</tr>
...
</tbody>
</table>