No pagination reset on using fnDraw

No pagination reset on using fnDraw

gunjannigamgunjannigam Posts: 8Questions: 0Answers: 0
edited July 2011 in General
I have to reload a page at specified time interval. I am using fnDraw along with setInterval to achieve this. I also need to update the display as it was before reload, i.e. with re-sort and re-filter and same pagination. fndraw helps me take care of re-sort and re-filter but changes my pagination . I also tried using [code] "bStateSave": true[/code] but that also didn't help. Help me put to take care of the problem

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    someone has written a plug-in function called fnStandingRedraw() to do this:

    http://datatables.net/plug-ins/api
    [code]
    $.fn.dataTableExt.oApi.fnStandingRedraw = function(oSettings) {
    //redraw to account for filtering and sorting
    // concept here is that (for client side) there is a row got inserted at the end (for an add)
    // or when a record was modified it could be in the middle of the table
    // that is probably not supposed to be there - due to filtering / sorting
    // so we need to re process filtering and sorting
    // BUT - if it is server side - then this should be handled by the server - so skip this step
    if(oSettings.oFeatures.bServerSide === false){
    var before = oSettings._iDisplayStart;
    oSettings.oApi._fnReDraw(oSettings);
    //iDisplayStart has been reset to zero - so lets change it back
    oSettings._iDisplayStart = before;
    oSettings.oApi._fnCalculateEnd(oSettings);
    }

    //draw the 'current' page
    oSettings.oApi._fnDraw(oSettings);
    };
    [/code]

    [code]
    /* Example call */
    $(document).ready(function() {
    var oTable = $('.dataTable').dataTable()
    oTable.fnStandingRedraw();
    } );
    [/code]
This discussion has been closed.