How to Refresh DataGrid when changing Data in ActionCompleteHandler
Hi All,
I have created a DataGrid with data from SQLite and everything works fine, except when I update the data for "Language" (which is a MultiSelect) & "System" (which is a FileManager), in an "OnActionComplete" method.
Neither of these two columns are from the base data source of the grid, (as each "Emulator" can have multiple "Languages" & multiple "Systems"). These columns are set up in "<Template>" & "<EditTemplate>".
The database updates correctly, but the changes do not reflect in the Grid. I have tried using both "Grid.Refresh()" & "StateHasChanged()" with no success.
How can I update external data in the "OnActionComplete" method and then get the Grid to refresh?
Thanks in advance
Simon
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
VN
Vignesh Natarajan
Syncfusion Team
September 14, 2020 10:58 AM UTC
Hi Simon,
Thanks for contacting Syncfusion support.
Query: “except when I update the data in an "OnActionComplete" method. These columns are set up in "<Template>" & "<EditTemplate>".The database updates correctly, but the changes do not reflect in the Grid. I have tried using both "Grid.Refresh()" & "StateHasChanged()" with no success”
We have analyzed your query and we understand that you are facing issues with the two column values which uses Template and EditTemplate to display values in Grid. And also you have mentioned that you are updating the values in OnActionComplete event of the Grid. OnActionComplete event will be triggered once the action is completed. So we suspect that you are updating the changes in OnActionComplete event of Grid when RequestType is Save and at the same time you are updating in your database. Hence the changes are reflected in the database not in Grid.
If you are updating the changes in OnActionComplete event of Grid, then we suggest you to use OnActionBegin event of the Grid when RequestType is Save instead of OnActionComplete event. Because OnActionBegin event will be triggered because an action gets started. Refer the below UG documentation for your reference
if you are still facing the issue, kindly get back to us with following details.
- Share your Grid rendering code example
- Share the details about the actions performed in events and how you are updating in your database.
- Share your Syncfusion.Blazor Nuget package version details.
- Also share the details about the Language and System Column along with Template definition.
Above requested details will be helpful for us to validate the reported query at our end and provide solution as early as possible.
Regards,
Vignesh Natarajan
Marked as answer
SI
Simon
September 18, 2020 11:15 AM UTC
Hi Vignesh,
Thanks for the reply.
User error :( I had used OnActionBegin elsewhere!
Regards
Simon
VN
Vignesh Natarajan
Syncfusion Team
September 21, 2020 11:36 AM UTC
Hi Simon,
Thanks for the update.
Kindly get back to us if you have further queries.
Regards,
Vignesh Natarajan
SIGN IN To post a reply.