Hello,
I'm trying to implement user preference management on pages where I have RadzenDatagrid components with many columns. I haven't found or understood how to do this using the ColumnPicking property! I want to be able to store these preferences in the database. At this point, I have a collapsible section above the Datagrid that displays checkboxes for each column of the entity presented in the Datagrid and a Dictionary (columnVisibility) that can be serialized to the database to store the user's choices. The Datagrid code is as follows :
<RadzenDataGrid @ref="grid" AllowFiltering="true" AllowSorting="true" FilterMode="FilterMode.Advanced" PageSize="10" AllowPaging="true"
PagerHorizontalAlign="HorizontalAlign.Left" TItem="Data" Data="@pagedData"
ColumnWidth="200px" ShowPagingSummary="true" Count="@totalRecords" LoadData="@LoadData">
<Columns>
@foreach (var entry in columnVisibility)
{
if (entry.Value)
{
<RadzenDataGridColumn TItem="Data" Property="@entry.Key.Replace(" ", "_").ToUpper()" Title="@entry.Key" />
}
}
</Columns>
</RadzenDataGrid>
My problems are as follows: when I change the visibility of the columns, the headers change, but the row data doesn't! As long as I don't reload the page in the browser. I've tried requesting grid.Reload() in several places, but it doesn't work! I implemented the Change event at the checkbox level and then I assign null to the pagedData collection that populates the Datagrid to force a reload, and it works! but if I changed my column, on let's say the tenth page, my data is displayed on page 1 and I lose the pagination Can you tell me if there is an example of an implementation that could be simpler with ColumnPicking, or tell me how to achieve this with my homemade method
In any case, congratulations for the high quality of what you offer as a community solution!
regards