Issue with jquery datatables ajax datasource

时间:2015-05-12 22:25:56

标签: asp.net-mvc-5 jquery-datatables

I've followed the example shown on the datatables website for making an ajax request and I can't get it to work with the data tables nuget package. The model binder is mad because the search value is null and expects it to be an empty string.

Controller:

[WARN] [320]org.hibernate.procedure.internal.ProcedureCallImpl[prepareForNamedParameters]  - HHH000456: Named parameters are used for a callable statement, but database metadata indicates named parameters are not supported.

View:

public JsonResult ListUsers([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest request)

The value of the search cannot be null. If there's no search performed, provide an empty string. Parameter name: value

1 个答案:

答案 0 :(得分:3)

如果您正在使用服务器端处理,则需要添加'serverSide': true作为DataTables参数,请参阅以下代码:

$('#users-table').dataTable({
  'serverSide': true,
  'ajax': '@Url.Action("ListUsers", "Businesses",null,Request.Url.Scheme)'
});