Data table page length and start params does not synchronize with json endpoint.
Data table page length and start params does not synchronize with json endpoint.
kingtonu
Posts: 3Questions: 1Answers: 0
I want to synch my json params with data table params. please help me how can i fix it.
here is my code.
var table = $('#example').DataTable( {
serverSide: true,
processing: true,
pagingType: "full_numbers",
paging: true,
lengthMenu: [10, 25, 50, 75, 100],
ajax: {
url: 'http://localhost:8080/file/myjson.do',
dataFilter: function(data){
var json = jQuery.parseJSON( data );
//this is working fine
json.data = json.dataList;
json.recordsFiltered = json.AlldataList;
//
//the last 2 not working.
json.length = json.pageSize;
json.start =json.startIndex;
return JSON.stringify( json ); // return JSON strin
}
});
json response
dataList […]
AlldataList 3471
startIndex 0
pageSize 10
This discussion has been closed.
Answers
Hi @kingtonu ,
This thread should help, it's asking the same thing. See Kevin's example in the final message.
Cheers,
Colin
json.length = json.pageSize;
json.start = json.startIndex;
table pagination and page size not working because of this two parameters..
how can i fix it ???
data: function ( d )
{
d.pageSize = d.length;
d.startIndex = d.start;
}
Fixed thanks i founded solution in other question