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

2 posts, 0 answers
  1. Richard
    Richard avatar
    11 posts
    Member since:
    Aug 2010

    Posted 21 Aug 2014 Link to this post

    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.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 22 Aug 2014 Link to this post

    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.
     
  3. DevCraft banner
Back to Top