DataTables logo DataTables

via Ad Packs
advance pagination with script
  • wpswps
    Posts: 15
    I am trying to advance/retreat the pagination (next or previous page) within a script. I have seen how custom pagination controls can be made creating a plug-in with the API, but this is not what I want to do. I simple want to advance or retreat the pagination when certain conditions are met within a script.

    I have tried…

    oSettings._iDisplayStart = newValue;
    oTable.fnDraw();
    

    …but it does nothing. The only way I have gotten it to work is "clicking" the next/previous buttons virtually with jQuery's click() event…

    $('.paginate_enabled_next').click();
    

    …but that seems like a hack. How can I make this work using DataTables' building in functions/features?
  • allanallan
    Posts: 15,551
    Hi wps,

    The reason that setting _iDisplayStart before calling fnDraw() is discussed here http://datatables.net/forums/comments.php?DiscussionID=607 and here http://datatables.net/forums/comments.php?DiscussionID=573 . There are ways around it the display being set back to the first page - and you might want to implement one of these, as required.

    There is also the option of invoking the click event on "oSettings.nNext" and oSettings.nPrevious" (two button paging only - a small modification would be needed for this in full_numbers) which is what I do in the unit tests.

    Basically it comes down to the fact that there isn't really an API function for "paging turning" - perhaps one for a plug-in... :-)

    Regards,
    Allan
This discussion has been closed.
← All Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion