Hi Admir Hodžic,
Based on your query , we would like to clarify that when you set EnablePersistence
to true in the grid, the grid's state management automatically stores the state
during runtime. The persisted data is saved in local storage, so when
you rerun the project, the persisted state will be maintained based on the
previously stored data. This is the default behavior of the grid.
As you mentioned, if you add the new column
or changes to the field mapping of an existing column, the grid may not render
correctly due to the persistence feature. This is because the persisted data in
local storage retains previous settings such as column settings, page settings,
filtering settings, search settings, sort settings, and group settings. For
more details on the properties that are retained, please refer to the API links
provided below.
Class
GridFilterSettings - Blazor API Reference | Syncfusion
Class
GridColumn - Blazor API Reference | Syncfusion
Class
GridGroupSettings - Blazor API Reference | Syncfusion
Class
GridSearchSettings - Blazor API Reference | Syncfusion
Class
GridSortSettings - Blazor API Reference | Syncfusion
help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridGroupSettings.html
So,
we suggest to you clear the persisted data, we suggest using
localStorage.clear(); in the browser console. Or you can use the public method ResetPersistDataAsync
in the grid to reset the persistence settings whenever modifications are made
to the code. Kindly refer to the below ug link for more information.
Reference:
State
Management in Blazor DataGrid Component | Syncfusion
Class
SfGrid<TValue> - Blazor API Reference | Syncfusion
https://www.w3schools.com/jsref/met_storage_clear.asp
Regards,
Prathap Senthil