BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi,
In the DataGrid, I use AllowResizing, AllowReordering and EnablePersistence. How can I set default values for column order and column width for the first time when the user runs the page?
thank you
Hi Sarah,
Based on your query, we suspect you want clear persistence when grid is created. We have ResetPersistDataAsync used inside the grid created event. Please refer the code snippet and documentation for more information.
public void CreatedHandler(object args) { Grid.ResetPersistDataAsync(); }
|
Documentation ; https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_ResetPersistDataAsync
https://blazor.syncfusion.com/documentation/datagrid/state-management#handling-grid-state-manually
https://blazor.syncfusion.com/documentation/datagrid/events#created
Please let us know if you have any concerns.
Regards,
Naveen Palanivel
Hi,
I don't want to reset all user settings. Suppose we have columns A, B, C, D. I hide column C by default in the source code. The first time the user opens the page, there is a hidden C that can be removed from the hidden state. The next time the user opens the page, I want the same settings that the user set last time to be displayed, and I don't want to reset the settings.
I want the following items to be removed from the data grid settings on page load:
1-Grid_Column_HeaderFilter
2-Grid_ToolbarItem_Search_content
3-Grid_Column_Sort
Hi Sarah,
Thanks for the patience.
Query: “I want the following items to be removed from the data grid settings on page load”
Yes we can achieve your requirement by clearing the unwanted settings in the persist properties and we suggest you to set new properties in Grid settings.
We have discussed the similar query on the below tread. So kindly refer the attached thread for your reference.
Reference: https://www.syncfusion.com/forums/172940/datagrid-toolbar-items-icon?reply=S2Jkb8
Also please find the attached sample using latest Nuget version for additional information and let us know if you face any difficulties.