Hi,
We ran into an issue with manual binding and selected items with Grid component. I used the 'WebApiFromServerApp' sample in 'grid\datasourcerequest-on-server' folder from Telerik's samples on GitHub.
To recreate the issue, modify 'GridWithService.razor' file in 'WebApiFromServerApp' project. I attached modified project.
To test the behavior:
Thank you.
Hello Arash,
In this case, I can only suggest to preserve and maintain the selected items manually. For example -
Regards,
Dimo
Progress Telerik
Hi Dimo,
The problem is our grid is bound to the list of ExpandoObject object.
private List<ExpandoObject> GridData { get; set; }
Since ExpandoObject is sealed we can't derive and override Equals() method.
Regards
Hi Arash,
The observed behavior means that the row instances (object references) change on every Grid rebind. That's why the Grid cannot map the selected row objects in the SelectedItems variable to the items in the current data collection (args.Data).
In your case, override the Equals() method of the Grid Model class, so that .NET compares the rows by their unique IDs, and not by their object references.
Regards,
Dimo
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.