Page Numbering

Page Numbering

mediatomcatmediatomcat Posts: 7Questions: 2Answers: 0

Hi,

I am leaving a table to another page and then returning and would like to know what parameter I can set to set the correct page number. I am able to show the right data, by using the iStart and iLength parameters, but even though the data is page 2 data, then buttons at the bottom still say page 1.

Any ideas?

Answers

  • RpiechuraRpiechura Posts: 98Questions: 3Answers: 14
    edited June 2014

    It sounds like what you want may be http://datatables.net/reference/api/page() .

  • mediatomcatmediatomcat Posts: 7Questions: 2Answers: 0

    I tried this, but it hangs the page on Processing:

    "fnPreDrawCallback": function( oSettings ) {
    var table = $('#datatable_tabletools').DataTable();
    table.page( 'next' ).draw( false );
    }

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    We talked about this by e-mail a bit, but for anyone else reading, the stateSave feature will handle paging. Enable state saving and then when you come back to the page the state (sorting, paging and filtering) will be restored.

    Allan

  • mediatomcatmediatomcat Posts: 7Questions: 2Answers: 0

    Thanks Allen. Good quick feedback.

    The way to set the page if you are not using stateSave:

    oT.fnPageChange( 1 ); // 1 being page 2

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Yes, the method you are using will still work, but I guess the question is, how to you know what page to jump to? If you always want to jump to page 2, then your call above should work okay.

    Allan

  • mediatomcatmediatomcat Posts: 7Questions: 2Answers: 0

    I am using a session to pass the value:
    oT.fnPageChange( <?php echo ($_SESSION['pageNumber']; ?> );

This discussion has been closed.