Help with Server-Side pagination

Help with Server-Side pagination

matteo1991matteo1991 Posts: 5Questions: 2Answers: 0

Hello,

I'm using DataTables 1.10.2 but I'm experiencing some problems with the server side processing.

my configuration is:

bServerSide: true,
sServerMethod: 'POST',
sAjaxSource: 'myServerSideScript'

in my server side script I handle filtering so that I can filter 10/25/50 or 100 records, and when I change the record number the filter is correctly applied.
The problem is that the number of pages is not updated according to the new page size, and i always see only "page 1".
I think the problem relies on the data returned from my server side script, but in the manual I'm not able to understand which parameters have to be returned...

I'm currently returning aaData, iTotalRecords and iTotalDisplayRecords. But I've seen in the manual that there are also recordsTotal and recordsFiltered, that seems to be the same thing.

Do someone know what I'm doing wrong? I need to return some other parameter? Or I have to do some extra calculations? I've tried everything but I didn't manage to fix it.

Thank you for your time,

Matteo

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    Answer ✓

    But I've seen in the manual that there are also recordsTotal and recordsFiltered, that seems to be the same thing.

    That's the 1.10 style. The i* parameters are for 1.9. See the legacy section of the server-side processing manual.

    It sounds like you aren't taking iDisplayLength (or length in 1.10) into account if you are always just returning 10 rows.

    Allan

  • matteo1991matteo1991 Posts: 5Questions: 2Answers: 0

    Thanks Allan for the explaination,

    I figured out that I was wrongly understanding the meaning of recordsFiltered, and I was setting it to only the 10 records I had in the current view. For this reason the paging was not working.

This discussion has been closed.