We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to get the Grid settings in React Grid

Hi All,

I would like to be able to save the status of the  the column filters and sorting, so that it appears at the initial load of the component.





Where can I get this information in the same format that I can initialize the filters and the sorting?



Than you very much.
Regards.

1 Reply 1 reply marked as answer

SK Sujith Kumar Rajkumar Syncfusion Team July 3, 2020 07:32 AM UTC

Hi Raul, 
 
Greetings from Syncfusion support. 
 
From your query we could see that your requirement is to get the grid settings so that you can store and restore them later. You can use the Grid’s getPersistData method to get the current grid settings to achieve your requirement. This will return the settings as displayed in the below image, 
 
 
 
Then you can restore the entire saved settings or the required settings to the Grid using its setProperties method as demonstrated in the below code snippet, 
 
var grid = document.getElementById('grid').ej2_instances[0] 
var persistData = JSON.parse(grid.getPersistData()) 
// Restores the filter and sort settings to the Grid 
grid.setProperties({ filterSettings: persistData.filterSettings, sortSettings: persistData.sortSettings }) 
// Restores the entire settings to the Grid 
grid.setProperties(persistData) 
 
 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon