Pipelining broken

Pipelining broken

brianjlowrybrianjlowry Posts: 2Questions: 0Answers: 0
edited May 2014 in DataTables 1.10

This is an issue I can replicate on the site's demo here: http://datatables.net/examples/server_side/pipeline.html

Click on page 6 to force pipelining. Now click page 5. The paging loses the start position and begins from 0 again.

Replies

  • brianjlowrybrianjlowry Posts: 2Questions: 0Answers: 0
    edited May 2014

    I've fixed the bug. The pipeline.js file needs this code block replaced:

    if ( requestStart < cacheLower ) {
                requestStart = requestStart - (requestLength*(conf.pages-1));
    
                if ( requestStart < 0 ) {
                    requestStart = 0;
                }
            }
    
            cacheLower = requestStart;
            cacheUpper = requestStart + (requestLength * conf.pages);
    

    with this:

    if (requestStart < cacheLower) {
                cacheLower = requestStart - (requestLength * (conf.pages - 1));
    
                if (cacheLower < 0) {
                    cacheLower = 0;
                }
            } else {
                cacheLower = requestStart;
            }
    
            cacheUpper = cacheLower + (requestLength * conf.pages);
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    Thanks for flagging this up and the fix. I've put in a slightly different fix actually, as I think the problem was more in how retrieved data was handled: https://github.com/DataTables/DataTablesSrc/commit/76ef32a31472 . Would interested to hear how you get on with it.

    Thanks,
    Allan

This discussion has been closed.