Keep user filtering and sorting after user changes page and returns

Keep user filtering and sorting after user changes page and returns

mikemakusmikemakus Posts: 9Questions: 0Answers: 0
edited October 2009 in General
Hi,

I have a list of products in my datatable with different filtering and sorting options. The user can click on items in the table to go to the corresponding description page. Then when the user clicks the back button of the browser or the index button (going back to the table), the filtering and sorting disappear. This is normal because the datatable is reinitialized. But I'd like to keep that data..

What's the best way to store the sort and filtering data in order to get it back when the user returns the tables page ? Cookies perhaps?

Replies

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin
    Hi mikemakus,

    You can use the bStateSave option to deal with this. In combination with a reasonably short time out period on the cookie that DataTables uses to store the information, this will overcome your 'back button' issue:http://datatables.net/usage/features#bStateSave

    Regards,
    Allan
This discussion has been closed.