Keep user filtering and sorting after user changes page and returns
Keep user filtering and sorting after user changes page and returns
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?
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?
This discussion has been closed.
Replies
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