Articles in this section
Category / Section

Usage of ej persist state version property in JavaScript Grid.

3 mins read

In certain cases, we may make changes in a control model(application) and thus would like to see the changes getting reflected in the browser view without being conflicted with the previous model. In such cases, ej.persistStateVersion will come in handy in JavaScript Grid.

Solution

In detail, let us consider an example where the user renders a grid (with enablePersistence enabled) in page.

Now the user makes some changes in the application level, the grid should reflect the changes made in the grid model.

We have provided the version based storage support such that we invalidate the previously stored data from local storage and the newly stored item will be based on the version specified. We can define this using the ej.persistStateVersion property which accepts a string value. Please refer to the below code example. 

<script type="text/javascript"> 
    ej.persistStateVersion = "test";//any string value can be set 
</script> 

 

The ej.persistStateVersion is a global variable which is used to reflect the changes that are made to the Syncfusion control model (in application) in the browser.

So, if you would like to ensure the property usage, we suggest you to run your application and make some changes in the layout of the Grid in browser. If you reload the page, you could see the modified changes persisted in grid.  

 

Then re-run the sample with ej.persistStateVersion defined. In this case, you could see that the changes made in the layout of the grid would have been no more persisted and thus grid will be rendered based on the defined settings. Now, if you make the changes to grid layout and reload the page, the modified changes will be persisted in the grid. 


Note: Whenever you modify the grid model from application, we suggest you to change the ej.persistStateVersion such that it invalidates the previously stored data and render grid based on newly defined model. And, please use the above code only when changing the grid model in application. It is not necessary to use this property when modifying the grid layout in browser view page. 


Conclusion

I hope you enjoyed learning about usage of ej.persist state version property in JavaScript Grid

You can refer to our JavaScript Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Grid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied