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

GroupDescriptor and AggregateFunction work only on initial load, changing grouping loses aggregate

1 Answer 142 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 21 Aug 2014, 04:14 PM
My grouping code with showing an aggregate function is working on initial load, but when removing the grouping, then adding it back, the group doesn't show the aggregate function again.

I've added the following code to my manually configured radgridview to allow grouping and to display a count.  As I said, on initial load, the aggregate function works fine. See image grouped_initial.png

<telerikGrid:RadGridView.GroupDescriptors>
     <telerikData:GroupDescriptor Member="StatusDescription" DisplayContent="Current Status">
          <telerikData:GroupDescriptor.AggregateFunctions>
               <telerikData:CountFunction Caption="Count: "/>
          </telerikData:GroupDescriptor.AggregateFunctions>
     </telerikData:GroupDescriptor>
</telerikGrid:RadGridView.GroupDescriptors>


If I remove the 'Current Status' (clicking the little X) grouping I see all the data, and this is expected.  If I drag this same column that has the aggregate function ('StatusDescription') back to the grouping window I lose the aggregate function that was created in the xaml above.  See image grouped_again_after_ungrouping.png.   Am I missing something to get the function to fire again?

FYI, we're using MVVM.

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 22 Aug 2014, 01:55 PM
Hi,

You have defined a GroupDescriptor initially and it is applied as you start the application and RadGridView is initially loaded. Once you clear the grouping you have defined in XAML, it does not take any effect any more.

Then, as you drag a column header and drop it in the group panel, a new ColumnGroupDesctriptor is added. You can check the Programmatic Grouping documentation on how to define ColumnGroupDescriptor.

The ColumnGroupDescriptor itself does not expose an option to add AggregateFunctions.
You can define such on the column bound to StatusDescription property itself. You can check the documentation on Aggregate Functions.
If you defin such a function for the column you group on the value of the AggregateFunction should be shown for the Group header . You can check the online demos for an example.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Richard
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or