之前我开发过mvc应用程序。我目前正在研究基于cRUd的应用程序。我必须使用JQuery Bootgrid。基础结构是VS 2013. MVC 5.但是当我在表上调用bootgrid函数时,表格不会被渲染,只有搜索插件出现在屏幕上。在chrome中调试时,我会在脚本声明后看到一些错误符号。我很无能为力,任何建议都会有所帮助。
我正在附加我的代码以及来自chrome的屏幕图像。
@model COE.Tools.Adapt.DataTransferObjects.ViewModels.UserProfileViewModel
@{
ViewBag.Title = "Manage User Information";
}
<div class="row">
<div class="col-lg-12">
<h2 class="sub-header">ManageUsers</h2>
</div>
<!-- /.col-lg-12 -->
</div>
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-lg-2 col-md-3">
<i class="fa fa-user fa-3x" aria-hidden="true"></i>
<button id="btnAddNew" value="NewUser" class="btn btn-default">NewUser</button>
</div>
</div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-12 col-md-12">
<table id="gridUsers" class="table table-bordered table-hover">
<thead>
<tr id="tbHeader">
<tr>
<th data-column-id="firstName">FirstName</th>
<th data-column-id="lastName">LastName</th>
<th data-column-id="userId">UserId</th>
<th data-column-id="email">Email</th>
<th data-column-id="role">Role</th>
<th data-column-id="app">Applications</th>
<th data-column-id="plant">Plant</th>
<th data-formatter="Edit">Edit</th>
<th data-formatter="Delete">Delete</th>
</tr>
</thead>
<tbody>
@{
foreach (var vm in Model.lstUserInformation)
{
<tr>
<td>@vm.FirstName</td>
<td>@vm.LastName</td>
<td>@vm.UserId</td>
<td>@vm.Email</td>
<td>@vm.RoleDescription</td>
<td>@vm.UserApplication</td>
<td>@vm.DefaultLocation</td>
<td>
<a id="idEditUser" href="@Url.Action("EditUser", "Account", new {@userId = @vm.UserId })"><i class="fa fa-pencil-square-o fa-2x" aria-hidden="true"></i> Edit </a>
</td>
<td>
<a id="idDeleteUser" href="@Url.Action("DeleteUser", "Account", new {@userId = @vm.UserId })"><i class="fa fa-trash fa-2x" aria-hidden="true"></i> Delete </a>
</td>
</tr>
}
}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@section MyScripts {
<script type="text/javascript">
$(document).ready(function () {
alert('opk');
$("#gridUsers").bootgrid({
caseSensitive: false,
sorting: true,
multiSort: true,
selection: true,
rowSelect: true,
multiSelect: true,
keepSelection: true,
searchSettings: {
delay: 100,
characters: 1
},
labels: {
infos: "GridResults",
search: "GridSearch",
noResults: "GridNoResults",
all: "GridAllRowCount",
loading: "GridLoading"
},
formatters: {
}
});
});
</script>
}
答案 0 :(得分:1)
找到我的问题。愚蠢的我。我有2 tr,第一个没有数据。
感谢您查看我的问题。