Is Aggregate supported for nested properties in DataGrid?

1 Answer 72 Views
DataGrid
Jamison
Top achievements
Rank 1
Iron
Jamison asked on 17 Oct 2023, 05:47 AM

Hi,

I tested nested properties in data grid by following this doc https://docs.telerik.com/devtools/maui/controls/datagrid/columns/nested-properties. But got an error at the footer of City Column when I counting the cities by PropertyAggregateDescriptor for this column


 

So I am wondering is aggregate supported for nested properties?

Jamison

1 Answer, 1 is accepted

Sort by
1
Accepted
Didi
Telerik team
answered on 17 Oct 2023, 09:50 AM | edited on 17 Oct 2023, 10:07 AM

Hi Jia,

Thank you for the provided information.

I have tested the case and yes, the aggregates do not support nested property. I will need some additional time to discuss the case with the development team, and will send a reply in a day or two.

For now as a solution you can manually define the value for the footer text for the concrete column:

 var column = this.grid.Columns[2];

 var data = this.vm.Persons;
 if (data != null)
 {
     var collection = new ObservableCollection<Person>();
     foreach (var item in data)
     {
         if (item.Address.City != null)
         {

             collection.Add(item);
         }
     }
   column.FooterText= "Total count: " + collection.Count.ToString();
 }

I have attached the solution to this ticket. 

Thank you for the understanding.  

Regards,
Didi
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com
Jamison
Top achievements
Rank 1
Iron
commented on 19 Oct 2023, 03:20 AM

Thanks Didi.  So do you have a future plan to make it supported?
Didi
Telerik team
commented on 19 Oct 2023, 11:07 AM

Hi Jia, 

The feature request is logged here: https://feedback.telerik.com/maui/1627861-datagrid-support-for-nested-properties-in-the-propertyaggregate-descriptor Cast your vote and follow the item to track its progress.

FooterText approach displays the total count for the items which value is not null. You can remove the null check if the scenario you want to achieve is different and also want to count the null values.

Delegate aggregate descriptor:

You can use the Delegate aggregate descriptor for columns with nested properties. I have attached the files used. Again there is an approach with null check and without null check. based on your scenario. You may need to extend the logic to match the exact case you have. 

Tags
DataGrid
Asked by
Jamison
Top achievements
Rank 1
Iron
Answers by
Didi
Telerik team
Share this question
or