Asp.net mvc 5 jquery数据表ajax数据源问题
我已经按照datatables网站上显示的示例发出ajax请求,但我无法让它与data tables nuget包一起工作。模型绑定器是mad,因为搜索值为null,并且希望它是空字符串 控制器:Asp.net mvc 5 jquery数据表ajax数据源问题,asp.net-mvc-5,jquery-datatables,Asp.net Mvc 5,Jquery Datatables,我已经按照datatables网站上显示的示例发出ajax请求,但我无法让它与data tables nuget包一起工作。模型绑定器是mad,因为搜索值为null,并且希望它是空字符串 控制器: public JsonResult ListUsers([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest request) 视图: # 名字 姓 $(函数(){ $(“#用户表”).dataTable({ ajax:'@Url.A
public JsonResult ListUsers([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest request)
视图:
#
名字
姓
$(函数(){
$(“#用户表”).dataTable({
ajax:'@Url.Action(“ListUsers”,“Business”,null,Request.Url.Scheme)'
});
});
搜索的值不能为null。如果未执行搜索,请提供空字符串。
参数名称:value如果使用服务器端处理,则需要添加
'serverSide':true
作为DataTables参数,请参见下面的代码:
$('#users-table').dataTable({
'serverSide': true,
'ajax': '@Url.Action("ListUsers", "Businesses",null,Request.Url.Scheme)'
});
你确定你期望的是,尤其是
搜索[value]
?我不期望任何东西,Nuget包和jquery库一起工作,不需要自定义代码。如果你使用服务器端处理,你需要添加“服务器端”:true
数据表参数。@Gyrocode.com服务器端是我需要使用的,而不是网站上的ajax示例。如果你想回答,我会接受的。
$('#users-table').dataTable({
'serverSide': true,
'ajax': '@Url.Action("ListUsers", "Businesses",null,Request.Url.Scheme)'
});