DataTables State Restore Clarification
DataTables State Restore Clarification
barrierreef
Posts: 7Questions: 2Answers: 0
I am currently trying to implement the state restoration extension into my project and I am confused about how it works. There are 2 functions that look like they do the same thing but I am unsure what is different. What is the difference between stateRestore.state.add() and stateRestore.state().save()? When should I use one over the other? Thank you
This question has an accepted answers - jump to answer
Answers
stateRestore.state().save()
will only save/update states that are already created, ie, listed under theSaved States
button. ThestateRestore.state.add()
will allow you to create new state which will then be listed under theSaved States
button.You will get a Javascript error when using
stateRestore.state().save()
to save a state that doesn't exist. EitherstateRestore.state.add()
or theCreate State
button will need to be used before you can programmatically save the state usingstateRestore.state().save()
.Does this help?
Kevin
That does help my understanding a lot. I am using stateRestore without the buttons so this is definitely good to know thank you!