I use PagingAndSortingRepository
of Spring framework for my app. When Page interface in server response to client with parameter: totalPages
, totalElements
, numberOfElements
,size
. But client datatable jquery (datatable.net) needs draw
, recordsTotal
, recordsFiltered
parameters.
Please help me to resolve this problem.
Use the ajax.dataSrc
callback for preprocessing the response :
$('#example').dataTable( {
serverSide: true,
ajax: {
url: "path/to/server",
dataSrc: function(json) {
json['recordsTotal'] = json['totalElements'];
json['recordsFiltered'] = json['numberOfElements'];
return json;
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With