Remembering Pagination

Remembering Pagination

applapsapplaps Posts: 12Questions: 0Answers: 0
edited June 2013 in General
Hey all,

Just wondering if someone could help me out here or point me in the right direction.

Scenario: A web application with multiple tabs in the screen. Tab 1 has a datatable, with pagination set to display 30 rows at a time. Say the user is on page 5 (they would be viewing rows 121-150). If the user goes to Tab 2, and navigates back, the datatable forgets where the user is and just loads page 1, displaying records 1-30.

What I need: Basically I just want the pagination remembered. The user should be able to switch tabs, and come back, and be on the same page they were on. In scenarios where they navigate back to Tab 1 and data has changed (say 30 rows were added at the beginning), it is acceptable that the page they were on may contain different data, so long as they are taken to the page they were previously on. In scenarios where they are on a page and rows are deleted, it should take the user to the last available page (example, 150 rows, user is viewing page 3, rows 61-90, navigates tp Tab 2, 150 rows are deleted, upon navigating back to Tab 1 there is no longer a page 3, so they are taken to page 2 and rows 31-50 are displayed).

Also, the web app uses datatables in various places, so I think setting bSaveState to true is not the correct way to go about this for me as I only want pagination remembered on this one datatable...

Does anyone have any advice/suggestions or can point me in the right direction? Many thanks.

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    [quote]If the user goes to Tab 2, and navigates back, the datatable forgets where the user is and just loads page 1, displaying records 1-30.[/quote]

    Could you provide a test case? I do not understand why the DataTable is re-initialized when you change tabs.

    It is possible to set the start record when initializing the DataTable: http://live.datatables.net/uzubuy/edit
  • applapsapplaps Posts: 12Questions: 0Answers: 0
    Thanks for the reply Koosvdkolk.

    This was resolved by adding - "bStateSave" : true - during initialisation of the specific DataTable.
  • applapsapplaps Posts: 12Questions: 0Answers: 0
    edited June 2013
    Please close
This discussion has been closed.