I use PagingAndSortingRepository
我的应用程序的 Spring 框架。服务器中的Page接口向客户端返回参数时:totalPages
, totalElements
, numberOfElements
,size
。但客户端数据表jquery(datatable.net)需要draw
, recordsTotal
, recordsFiltered
参数。
请帮我解决这个问题。
Use the ajax.dataSrc https://datatables.net/reference/option/ajax.dataSrc用于预处理响应的回调:
$('#example').dataTable( {
serverSide: true,
ajax: {
url: "path/to/server",
dataSrc: function(json) {
json['recordsTotal'] = json['totalElements'];
json['recordsFiltered'] = json['numberOfElements'];
return json;
}
}
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)