I am currently faced with something I would consider to be a bug:
I have a DataGrid which get's its data assigned in the LoadData event. Everything starts to work out, if I additionally set the data count attribute in the event.
However, I am unable to reload the data through e.g. a button click. I have changed the data on the backend database, but this is not reflected in the data grid. Additionally, when I enter a new record and click my button, I get the newly created record from the backend, but the changes of previous ones are not considered. For me, this means there is too much data cached and not renewed.
I did some additional analysis.
Apparently, new records are added to the datagrid if I create them on the backend and press the refresh button. Still, changes to already cached records are not updated.
I even implemented some sort of redirects which are not resulting in a refreshed cache. Any suggestions?
I have the same issue as well. I have a grid that I refresh on a timer that updates the grid data data source. Only add and deleted records refresh. Eventually after enough time goes by the records will get updated. If I edit a row through an edit dialog the row is updated correctly but not if itβs changed outside of the application. I have confirmed the data is showing the change when debugging but itβs as if the grid doesnβt know that a value has changed.
So I did some more testing and looked at the data. The grid data is not showing the correct data unless there is a new record added or a recorded removed. I have debugged the grid load event and it is not getting the current data for records already bound to the grid. I am getting the data in the gridload event and have a timer that calls the grid0.reload() method every 10 seconds.
Here is the grid loaddata event:
protected async System.Threading.Tasks.Task Grid0LoadData(LoadDataArgs args)
{
myTicketsGridEvent = args;
Have you checked data changes that you did to the backend meanwhile your page refreshing?
To me, it looks like the whole loaddata event has caching which prevents some functionalities.
For example the pagination does not work for me too when using the load data event.
Grid is showing the pages, but the pagesize is not considered and all records are presented.
This issue does not appear to be resolved and I'm dealing with the exact same problem. Edits do not appear in the grid unless I refresh the page (F5 or programmatically refresh). Adds and Deletes will appear, I can even insert a new record via SQL insert before clicking Save on an Edit operation - the new record will appear, but the changes do not. Clicking "Edit" on the same record will show the recent edits in edit window, but clicking "Save" will not show the edits on the grid.
I'm subscribing to the Dialog.Close() event, and calling Grid.Reload() in there.
The most ridiculous thing is that this same code works on another project without issue. Why will it not work here?
Hi all,
I have very similar issue. All CRUD operations work just fine (the changes appear in my database) but the datagrid only shows the CRUD changes after manually refreshing the page. I invoke a simple "await grid.Reload()" after any CRUD method, but it seems as if the reload() method does not do anything. I already tried a few things to try to get it to work, but without success.
Do I need something else besides the "await grid.Reload()" to get it to work?
Reload() method of the DataGrid will just rebuild the component UI using the value provided in Data property. If you use a service to retrieve your data you might need to to request it.
I can corroborate that there are indeed cases where the LoadData method is called, but the grid doesn't reflect the data that was loaded, even if StateHasChanged() was called. I put some logging into the Blazor side, and I can see that while the Render event is triggered, the grid itself is not re-rendered. I find that the following workaround will do what you want it to do:
_myData = null
_myDataGrid.Reload();
The DataGrid will not re-render for some reason until the _myData property has been changed.