SetPersistDataAsync not working well. Data is missing in grid view.
Hello,
I have a problem with setting the grid settings in a SfGrid in Blazor. We have a database which stores the current user settings of a view of a grid (visible columns, order of columns, size of columns etc.). We determine this settings with (grid.GetPersistDataAsync).
Now we want to load this settings when loading the grid. So we built an "OnLoad" method and connect this with the OnLoad event of the SfGrid (grid.SetPersistDataAsync). The settings will be loaded successfully, but there is no a big free space of lines, without showing any data. We can scroll the Grid, but only 12 of 35 records will be shown, the rest is just white space. I can refresh the page, refresh the grid, nothing will work. When I debug I can see that the Data source collection is correct with all 35 records. Also there is no FilterSettings entry within the loaded persist data. Strangely, when I e.g. resize a column (this will cause a new setting storage) and refresh the page afterwards, all of the records are visible. Seems like a bug for me.
We use NET.8 and Syncfusion version 27.2.4.
public async Task OnLoadTable()
{
string gridSettings = await GetLocalSettingsFromDB(_grid, _pageUrl, _userName);
if (!string.IsNullOrEmpty(gridSettings))
{
await _grid.SetPersistDataAsync(gridSettings);
await Task.Delay(100);
await _grid.Refresh();
}
}
Hi Mitja Carstensen,
Based on your requirement, we were able to reproduce the issue when using the
OnLoad event to set the grid settings with the SetPersistDataAsync method. In
this case, when using the OnLoad event, certain operations, such as data
binding, might not be completed. As a result, the data did not bind to the
grid, leading to the issue you faced. To resolve this, we suggest using the
DataBound event to achieve the requirement. Kindly refer to the code snippet
and sample provided below for your reference.
|
public async Task DataBound() { string Griddata = Service.GetGridState(); if (Griddata != null & IsfirstRender ) { IsfirstRender = false; LoadSateFilter(); }
} |
Reference:https://blazor.syncfusion.com/documentation/datagrid/events#databound
If still issue persists ,to further investigate the issue, we need additional
clarification from your side. Please provide the following details to help us
proceed:
- Could you please share the grid code along with the model class?
- Could you please share us the video demonstration of the issue with replication steps?
- To help us analyze the issue, could you provide a simple, reproducible sample that demonstrates the problem? This will allow us to identify the issue more effectively and provide a resolution. Alternatively, you could share your attempt to replicate the issue using the attached sample
The information you provide will be very helpful in validating the reported query on our end and in providing a solution as quickly as possible. Thank you for your understanding.
Regards,
Prathap Senthil
Attachment: DataGridState_2d0c6efc.zip
- 1 Reply
- 2 Participants
-
MC Mitja Carstensen
- Dec 5, 2024 07:17 AM UTC
- Dec 8, 2024 04:05 PM UTC