Data grid doesn't refresh properly

Hi, I have a problem with my DataGrid component. In my code I have a method which is called when I need to refresh the data in the grid (it is called, after creating, editing or deleting an item). I handle that on my own with my custom modal and EF Core. Below is my method code:

public async Task Refresh()
{
    Classes = db.Class.ToList();
    await Task.Delay(1000);
    Grid.Refresh();
    StateHasChanged();
}

And I call it like this:

await Refresh();

This mostly works, but sometimes the data doesn't refresh, or it appears and it dissapears in less then a second. Then I need to either refresh the page or pretend I am making a new item, so that the method is called, and it always works then. What else should I try?


1 Reply

MS Monisha Saravanan Syncfusion Team September 28, 2022 02:10 PM UTC

Hi Amadej,


Greetings from Syncfusion support.


We have checked your query and we suspect that you are facing issues with Grid refresh instead of calling Grid refresh we suggest you to fetch and assign the datasource again to the DataSource property of the Grid. So that it will reflect properly with the new Dataset.


If the reported issue still persist then kindly share the below details to validate further at our end.


  1. Share us the Grid code snippet.
  2. Share us the video demonstration of the issue.
  3. If possible kindly share us the issue reproduceable sample.


The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.


Regards,

Monisha


Loader.
Up arrow icon