Server Processing: pagination not working
Server Processing: pagination not working
Hi,
I am trying to use Server Side Processing with datatables 1.10.1 but I am having trouble to display the right pagination (I only see page 1 while it should show 2 pages because I have recordsTotal = 11):
Here is the json I am sending to the client:
{"draw":1,"recordsTotal":11,"recordsFiltered":10,"data":[["Gloria","Little","Systems Administrator","New York","10th Apr 09","$237,500"],["Haley","Kennedy","Senior Marketing Designer","London","18th Dec 12","$313,500"],["Hermione","Butler","Regional Director","London","21st Mar 11","$356,250"],["Herrod","Chandler","Sales Assistant","San Francisco","6th Aug 12","$137,500"],["Hope","Fuentes","Secretary","San Francisco","12th Feb 10","$109,850"],["Howard","Hatfield","Office Manager","San Francisco","16th Dec 08","$164,500"],["Jackson","Bradshaw","Director","New York","26th Sep 08","$645,750"],["Jena","Gaines","Office Manager","London","19th Dec 08","$90,560"],["Jenette","Caldwell","Development Lead","New York","3rd Sep 11","$345,000"],["Jennifer","Chang","Regional Director","Singapore","14th Nov 10","$357,650"]]}
Is there something that I am missing?
thanks
Answers
Hi,
I think I found the nswer to my questions: Both recordsTotal and recordsFiltered should be 11.
Now I want to figure out why the folowing response from the server still shows page 1 and not 2:
{"draw":2,"recordsTotal":11,"recordsFiltered":11,"data":[["Jennifer2","Chang","Regional Director","Singapore","14th Nov 10","$357,650"]]}
Thanks
Correct - from the documentation:
Without being able to load and debug the page I can't say for sure, but my guess is that the server is not responding with the data for page 2. Why that would occur is perhaps because the server is not correctly applying a offset to the SQL.
Allan
Hi Allan,
You are right. The script that I have in the server was not returning the draw parameter. so it is normal that the client does not highlight the correct page number. Works fine now.
Thanks