Datagrid reloading data after filtering on IEnumerable

Hi!

Must say the forums have been a great tool in working with these components, however I've stumbled across a problem which I haven't seen talked about anywhere and I can't understand why it occurs or perhaps if it's just something I'm doing incorrect and any help would be greatly appreciated!

I'm trying to filter a datagrid just like the "Workstatus as Model" in this demo Blazor DataGrid Component - Custom Filtering | Free UI Components by Radzen and it works perfectly fine when I'm just filtering the data.

However when filtering on an IEnumerable and updating an item and thereafter reloading the data from the database I get an error saying that the specified FilterProperty (in the demo "Name") is not a valid property/field on the main object type (Employee in the demo).

To "simulate" a reload from the database and recreate the issue in the demo code I simply added a button which just redeclares the employee data exactly like in the OnInitialized method and the same problem occurs:

warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: No property or field 'Name' exists in type 'Employee'
      No property or field 'Name' exists in type 'Employee' (at index 14)
...

So it appears perhaps that the datagrid tries to apply the filter using the FilterProperty directly on the Employee object instead of the specified Property which in this case is a IEnumerable where every object indeed has a property "Name". Am I simply using the filtering functionality incorrectly or is this an error?

I only get this error when filtering on IEnumerable properties that use a filter on a subproperty of the underlying object (i.e the Property="WorkStatuses" and FilterProperty="Name" on the IEnumerable, not the Employee object), if the property is directly on the object everything works as expected.

Please let me know if I need to clarify things further. I've also tried this on the latest version of Radzen (4.25.8) just to be sure it wasn't an old problem.

Kind regards
Simon

Hi @Simon_H,

I was able to reproduce and fix the problem - fix will be part of our next update early next week.

1 Like