Is it possible to maintain search between multiple pages
Is it possible to maintain search between multiple pages
edoarsla
Posts: 7Questions: 1Answers: 0
Hi,
On several pages I have a table with the same id, and stateSave is set to true. However, search is not maintained between these pages.
I see that localStorage key is different between these pages since it includes "location.pathname", but I am not sure if there is a way to override this.
Does anyone know how to do this in 1.10 version.
Thank you!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
You are absolutely correct, the default DataTables state saving methods will use the path to ensure that table state is independently saved. If you want to have the state saved over multiple pages for a common table, the
stateSaveCallback
andstateLoadCallback
options can be used to provide a custom state saving function. For example:In this case I've simply used a common
localStorage
key calledcommonTable
, but you could call that anything you want, and also use any data storage you want (sessionStorage
for example).Regards,
Allan
Thank you Allan!