Object with Nested ExpandoObject not Filtering

I have a model with a nested ExpandoObject for dynamically added attributes (code is shorten for brevity)


public class WorkOrder

    {

        public string CustomerName { get; set; }

        public string CustomerNumber { get; set; }

        public ExpandoObject ItemCategories { get; set; }

    }


I can display ItemCategories by using the complex binding as such:

<GridColumn HeaderText="@column.Caption"

                                            Field="ItemCategories.Inventory"

                                            AllowFiltering="true"

                                            AllowSorting="true"

                                            Format="@column.Format">

                                </GridColumn>



This works great but sorting on this column does not work and Filtering I get the following error:

Uncaught Error: System.Collections.Generic.KeyNotFoundException: The specified key 'Inventory' does not exist in the ExpandoObject.


How can I enable filtering on nested complex ExpandoObject? T


5 Replies

VN Vignesh Natarajan Syncfusion Team February 16, 2022 01:48 PM UTC

Hi Emilio,  

Thanks for contacting Syncfusion support.  

Query: “I have a model with a nested ExpandoObject for dynamically added attributes (code is shorten for brevity) 

As per your suggestion, we have prepared a sample with Grid component whose model consist of nested ExpandoObject. We are unable to reproduce the reported issue at our end (i.e.) sorting and filtering is working properly for that column. Kindly refer the below sample for your reference 


Kindly share the following details to validate the reported issue further at our end. 

  1. Share the Grid code example.
  2. Share the details on how you have bound datasource to Grid. (i.e.) using DataSource property or DataManager
  3. Are you facing issue while applying Initial filter to ExpandoObject column?
  4. Share the video demonstration of the issue you are facing.
  5. Share the Syncfusion Blazor NuGet package version details.
  6. If possible try to reproduce the reported issue in provided sample.

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

Regards, 
Vignesh Natarajan 



EL Emilio Lopez February 16, 2022 07:26 PM UTC

I am using .NET 5.0 is this compatible with that version? Thanks



VN Vignesh Natarajan Syncfusion Team February 17, 2022 10:03 AM UTC

Hi Emilio,  
 
Thanks for the update.  
 
Query: “I am using .NET 5.0 is this compatible with that version? Thanks 
 
Yes, this is compatible with your version also. Previously we have attached the Dot Net 6 project. Now we have attached the Dot Net 5 project. Kindly refer the below sample for your reference 
 
 
If you are still facing the issue, kindly get back to us with details requested in previous update.  
 
Regards, 
Vignesh Natarajan 



EL Emilio Lopez February 17, 2022 08:21 PM UTC

I noticed that if I create the ExpandoObject directly and I declare the properties directly like you guys did like this


ItemCategories.Inventory = "Lorem Ipsum"


it works great, however, this data comes from an API, the idea is that client should adapt if in the future an Item has new categories, so I am not sure if this has somethign to do with how System.Net.Http.Json deserializes the ExpandoObject. Any suggestions are appreciated



VN Vignesh Natarajan Syncfusion Team February 18, 2022 10:59 AM UTC

Hi Emilio,  
 
Query: “this data comes from an API, the idea is that client should adapt if in the future an Item has new categories, 
 
We are quite unclear about the query / issue you are facing. So kindly share the following details.  
 
  1. Are you facing issue while binding the data from API?.
  2. Or are you facing issue while running the provided sample?
  3. Share more details about the issue you are facing.
  4. Share the Grid code example.
  5. If possible share the issue reproducible sample or reproduce the reported query in the provided sample
 
The above requested details will be very helpful for us to validate the reported query at our and provide solution as early as possible.  
 
Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon