Articles in this section
Category / Section

Usage of ej.persistStateVersion property

2 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.

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. 

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