我正在使用jQuery数据表来为我的视图添加分页,排序等功能我已经按照所有步骤但是它不起作用,请帮帮我。
我已经通过nuget包管理器安装了datatable插件,并尽力弄清楚问题是什么,但我无法解决这个问题。
提前致谢:)
$(document).ready(function(){ $(“#customers”)。DataTable();
$("#customers ").on("click",".js-delete", function () {
var button = $(this);
bootbox.confirm("Are you sure you want to delete this customer?", function (result) {
if(result)
{
$.ajax({
url: "/api/customer/" + button.attr("data-customer-id"),
method: "DELETE",
success: function () {
button.parents("tr").remove();
}
});
}
});
});
});
</script>
}
// my bundle file
bundles.Add(new ScriptBundle("~/bundles/lib").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/bootstrap.js",
"~/scripts/bootbox.js",
"~/Scripts/respond.js",
"~/scripts/DataTables/jquery.datatables.js",
"~/scripts/DataTables/datatables.bootstrap.js"
));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/content/datatables/css/datatables.bootstrap.css",
"~/Content/site.css"));
//
my shared file where I added scripts to my views
@Scripts.Render("~/bundles/lib")
@RenderSection("scripts", required: false)