This is a migrated thread and some comments may be shown as answers.

[Solved] RadDataGrid Support for Aggregate Rows?

4 Answers 130 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 04 Apr 2013, 02:41 PM
Does the RadDataGrid provide support for aggregating data across either groups or the overall grid itself?  I'm showing a grid with numeric data and I'd like to include a row that shows the sum of the values for each column.

4 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 08 Apr 2013, 11:42 AM
Hello James,

At this moment our RadDataGrid control does not provide support for Aggregation, but this certainly is useful feature and exposing Aggregation API is in our TODO list for the Q2 2013 release.

If you have any other questions do not hesitate to contact us again.

 

All the best,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Thomas
Top achievements
Rank 1
answered on 20 Jun 2013, 09:24 PM
I believe this functionality has now been included in the latest release.  Is there an example of how to implement the functionality?  I don't see an example in the demo project.  If one of the sales examples was updated to include the total sales for each group in the group header, that would be helpful.

Thanks,
Tom
0
Ivaylo Gergov
Telerik team
answered on 24 Jun 2013, 09:36 AM
Hi Thomas,

Thank you for your question.

Basically, the provided Aggregates API exposes two ways to get aggregate values from a column or a group in the RadDataGrid:
  • with PropertyAggregateDescriptor :
Use the PropertyName to set the property from your Model that will provide the values and the Function property to set either a KnownFunction or implement a custom one.
  • with DelegateAggregateDescriptor :
This descriptor provides a ValueLookup property that will return an instance retrieved from the Model that will be used for the aggregate computation(Thus, you receive the whole object instead of its property value).

The aggregate value/s can be accessed through the IDataView interface that the RadDataGrid exposes(GetAggregateValue, GetAggregateValues methods). 
I have attached a project to demonstrate how to show an aggregate values in the group headers. Please, find the attached file.
For now, the GroupHeaderContext does not expose information about the current RadDataGrid instance, but we intend to extend the logic in the future. So, as you can see in the project, I have added a Grid dependency property in the Converter class, in order to get the aggregate values. 

We also intend to add different examples of using the Aggregate API in our SDK Examples next week. 

Feel free to contact me if you have any questions.

Regards,
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Thomas
Top achievements
Rank 1
answered on 25 Jun 2013, 06:22 PM
Thanks Ivaylo. 

I came up with a similar solution, but I was worried it was more of a work around.

Tom
Tags
Grid for XAML
Asked by
James
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or