Persist Content using local storage
Persist Content using local storage
How can we change the button text on its click and then persist after a page reload/browser termination in the below dataTable example:
How can we change the button text on its click and then persist after a page reload/browser termination in the below dataTable example:
Answers
The button text is just defined by ""defaultContent": "<button>Click!</button>"" - you would just change that, or did you mean something else?
If you want to persist filtering, ordering and pagination, you can use
stateSave
- see example here,Colin
Thanks Colin for your reply. Using stateSave, I am able to save the button state but when I terminate or reload the browser, it goes back to original state. Please share your valuable inputs on how to persist the state of button using Local Storage so that if I click on it its text should change to maybe 'View' and remain as it is. By default here all buttons have same 'id'/'text' so persisting their state is a bit tricky.
Thanks in advance!
Can you post what you have, please, as that will give us something to work with. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin