Paging Not Working with server side piping

Paging Not Working with server side piping

dfuscoiidfuscoii Posts: 3Questions: 0Answers: 0
edited May 2011 in Bug reports
Allan, first of all congratulations for the amazing Datatables addin. This is a lot of work you went through and also constantly supporting it, it's just great.

I'm using the addin with server side piping, returning 50 records at the time with a page size of 10 records.
Here is the dev site in question:
http://cks-dev.interventioninsights.com/Search/DrugAndDiagnosis/ClinicalTrials/Clinical/doxorubicin/(Cancer%20AND%20breast)

Everything looks good and works well. You can click on the page numbers sequentially up to page number 5, then click on page 6 and see that the next batch of records is being requested from the server, and so on.

However, if you navigate up to page number 5, then click on page 7 (skipping page 6), the data displayed is actually the page 6 data. It seems for some reason the rendering starts always at the first page of the next piped batch, even though you clicked on a page that is not the first of the next batch.

I double checked my code and watched the iDisplayStart variable in my server side code. I also looked at the js pipeline function and don't see anything wrong. Maybe the problem is in the fnServerData?

Any help is appreciated.

Replies

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    A curious one... I've not encountered this before, so I don't know immediately what the issue is, but it looks like the iDisplayStart being sent to the server is correct. On the first load: iDisplayStart:0. Then jump to page 5 and no XHR - good. Then jump to page 7 and iDisplayStart:60 - which is correct (50+ the 10 skipped). So I wonder if this might be a little issue with the server-side script. How are you doing the limit for the paging?

    Allan
  • dfuscoiidfuscoii Posts: 3Questions: 0Answers: 0
    edited May 2011
    Correct, but my server side is returning records 51-100 even if iDisplayStart is 60. That is because I think is supposed to get the next batch of 50 records. If my understanding about how the piping should work is correct, clicking on page 6 or 7 (or up to 10) should return the next 50 records, but display the appropriate page.

    If, on the other end my understanding is incorrect, that means my server code should return 51-100 when clicking on page 6, or 61-110 when clicking on page 7, and so on. If this is case, then my current server side code would be incorrect.

    I have a feeling the latter might be true, but I'll wait for you to kindly confirm before making changes.
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Yup - it should be the latter case. Whatever the pipelining asks for it expects to get from the server. You are correct that it could be made to be smarter, and do blocks like you suggest, but I went for a slightly more abstract, and I think flexible option than rigid blocks.

    Allan
  • dfuscoiidfuscoii Posts: 3Questions: 0Answers: 0
    Makes perfect sense. Thank you so much for the quick response. Again, it's a great plugin and I look forward to use it in many places.
This discussion has been closed.