In server-side processing can pagination be based on recordsTotal param instead of data param?
In server-side processing can pagination be based on recordsTotal param instead of data param?
jibranb
Posts: 10Questions: 3Answers: 1
I have enabled serverSide processing. I am hitting a slow-ish web service for my data, which supports paging, searching and sorting. All necessary params (start, length, search[value], etc.) are passed to and from the web service and it returns only the data for the current page.
Parameters sent
{
draw: 1,
start: 0,
length: 5
...
}
Parameters received
{
data: [{},{},{},{},{}], // exactly 5 rows
draw: 1,
recordsFiltered: 5,
recordsTotal: 1561
}
The issue I'm running into is pagination is based on the returned data param so there is no way to select a new page. Is it possible to display pagination buttons based on the recordsTotal param?
I hope this makes sense and isn't a stupid question.
Answers
I got it working. I misunderstood the definition of
recordsFiltered, which is what controls pagination. Sorry to bother!Here are my corrected return parameters.
No worries. Thanks for posting back and good to hear you've got it working now.
Allan