EnablePersistence with grid search

Hello All, 

my problem is when enabling persistence in data grid that has a search on it, it will remain even if I clicked refresh, but the problem here is that what I searched is not visible anymore and the user for example searched something that has no matching records, the grid will appear empty. He went to do other stuff in other page, came back to the page that has this grid that he performed search on it earlier and there is nothing in the search bar nor the grid, he will think that there is a bug in the program. How can I solve this problem?


Thank you in advance.


1 Reply

PS Prathap Senthil Syncfusion Team July 24, 2023 01:22 PM UTC

Hi Aya,


We'd like to inform you know that by enabling EnablePersistence, the current grid state was saved in the browser's local storage that why the search state will be maintained. This is the default behavior. Windows local storage will be maintained as long as the user delete it manually or cleared the browser cache. Also, ResetPersistData method to reset grid state to its original state. This will clear persisted data in window local storage and renders grid with its original property values.


kindly refer to the below link to clear the local storage manually

 https://www.w3schools.com/jsrEF/met_storage_clear.asp#:~:text=The%20clear()%20method%20removes,object%20or%20a%20sessionStorrage%20object.


Reference Link: https://blazor.syncfusion.com/documentation/datagrid/state-management#enabling-persistence-in-grid


Regards,

Prathap S


Loader.
Up arrow icon