Question about a problem related to DataTables Paging ...

Question about a problem related to DataTables Paging ...

vikinik01vikinik01 Posts: 4Questions: 3Answers: 0

Hey, I have a minor issue related to showing entries when paginating using DataTables. When I choose the 25 entries option, a call to the backend is made which successfully returns 25 items, however DataTables is still only showing 10 of them and also there's still only 1 page insteead of the expected 3 (note that I'm showing 10 items per page). What could be causing this problem? Thnaks in advance.

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    draw: 1 is very likely the issue. The draw parameter should be the same as what is sent to the server as part of the request (make sure you cast / parse it as an integer for security). See the manual here for details.

    Allan

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954

    This example is working properly. Screenshots are very difficult to troubleshoot :smile: Is the screenshot with the JSON response after you changed the page length to 25? If so the problem is with the response as it has draw: 1. Since this is the second request to the server it should have draw: 2. It is basically a sequence number. See the Server Side Processing docs for more details.

    If this doesn't help then please post a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • vikinik01vikinik01 Posts: 4Questions: 3Answers: 0

    Yup, I successfuly fixed it. Thank you very much for the instantenous feedback!

Sign In or Register to comment.