State Persistence

Edit in →

A state in SurveyJS Dashboard is an object containing visualizer settings that a user has changed while working with the dashboard. These settings include the selected locale, chart types, chart layout, sorting, filtering, and others. You can save the state and restore it after users reload the page, allowing them to resume working with the dashboard from where they left off. In this demo, the state is saved to and restored from localStorage. To test the state persistence functionality, change chart types, select different sort orders, or change the layout using drag and drop, and then reload the page. You should see your customizations persisted. Read more...

Sorry, we can't retrieve the data from server. Please comeback later.

A state in SurveyJS Dashboard is an object containing visualizer settings that a user has changed while working with the dashboard. These settings include the selected locale, chart types, chart layout, sorting, filtering, and others. You can save the state and restore it after users reload the page, allowing them to resume working with the dashboard from where they left off. In this demo, the state is saved to and restored from localStorage. To test the state persistence functionality, change chart types, select different sort orders, or change the layout using drag and drop, and then reload the page. You should see your customizations persisted.

To save the state, handle the onStateChanged event. A handling function contains the state object as the second parameter. Serialize this object to a JSON string and save this string to a desired storage.

To restore the state after a page reload, obtain the state as a JSON string from your storage, deserialize this string to a JSON object, and assign this object to the visualizer's state property or pass it to the setState() method.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.