How can I modify the string that stateSave uses for setting and retrieving from local storage?
How can I modify the string that stateSave uses for setting and retrieving from local storage?
user0ne23
Posts: 2Questions: 1Answers: 0
right now by default it seems to be using this command:
localStorage.setItem('DataTables_table_id_' + window.location.pathname, JSON.stringify(data));
I want to change the first parameter or the key to the data.
'DataTables_table_id_' + window.location.pathname
to something else.
This discussion has been closed.
Answers
You can use the
stateSaveCallback
option (and its partnerstateLoadCallback
) to define your own state storage.Allan
I only see an example with ajax in there using server storage.
Do you have any examples with customizing the key for localStorage?
I am fairly new not sure on how the syntax would work.
You've already got the syntax from the post you gave above . Its just a case of storing it in
localStorage
with the key you want.Allan