我是ASP和MVC的新手,所以我正在学习。我正在尝试在我的ASP.NET MVC 5测试项目中实现footable(我最终想要使用分页和排序功能,但一次一步)。
我已将.js文件和.css文件添加到项目中,并将它们包含在BundleConfig.cs文件中(见下文)。我不确定这是否是我需要做的才能在我的项目中使用它们。
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js",
"~/Scripts/footable.min.js",
"~/Scripts/footable.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/footable.bootstrap.min.css",
"~/Content/footable.bootstrap.css"));
我正在从MySQL数据库中检索数据并将其传递给我的视图,但我只是得到一个标准的html表,我做错了什么?
以下是视图代码: -
@model IEnumerable<MVC5Footable.Models.radacct>
@{
ViewBag.Title = "Index";
}
<table class="footable">
<thead>
<tr>
<th>@Html.DisplayNameFor(model => model.username)</th>
<th>@Html.DisplayNameFor(model => model.framedipaddress)</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.username)</td>
<td>@Html.DisplayFor(modelItem => item.framedipaddress)</td>
</tr>
}
</tbody>
</table>
<!-- Initialize FooTable -->
<script>
jQuery(function ($) {
$('footable').footable();
});
</script>
希望有人可以提供帮助。感谢。
答案 0 :(得分:0)
有点晚了,但是为了记录:您忘了包含dot
。
$('.footable').footable();