Custom Grouping and Aggregate functions

4 posts, 0 answers
  1. gisela
    gisela avatar
    15 posts
    Member since:
    Feb 2006

    Posted 09 Sep 2014 Link to this post

    In the RadGridView control i have a custom groupfunction:

    void Grid_Grouping (object sender, GridViewGroupingEventArgs e)
             {
                 if (e.Action == GroupingEventAction.Place)
                 {
                     var column = e.GroupDescriptor as Telerik.Windows.Controls.GridView.ColumnGroupDescriptor;
                     if (column! = null)
                     {
                         if (column.Column.UniqueName == "WeekDay")
                         {
                             e.Cancel = true;

                             var descriptor = new GroupDescriptor <VMDashBoardDataPoint, string, int>

                             {

                                 GroupingExpression = i => i.DayOfWeek,

                                 GroupSortingExpression = i => (i.FirstOrDefault () Ist.TimeRange.Start.DayOfWeek == (int) DayOfWeek.Sunday 7.? (Int) i.FirstOrDefault () Ist.TimeRange.Start.DayOfWeek.)

                             };

                             descriptor.DisplayContent = ((Telerik.Windows.Data.GroupDescriptorBase) (e.GroupDescriptor)) display content.

                             descriptor.SortDirection = e.GroupDescriptor.SortDirection;
                             this.Grid.GroupDescriptors.Add (descriptor);
                         }
                     }

                 }
             }

    Everything works except the Aggregate Functions. 
    How can this function be changed, so that Aggregate Functions work?


    Best regards

    Gisela Fromm 

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 10 Sep 2014 Link to this post

    Hello Gisela,

    I checked the code snippet and I am not seeing any code related to aggregate functions. May I ask you to share some more information on how have you defined those functions?

    Generally there is an option to directly add AggregateFunctions for the specific GroupDescritor through its descriptor.AggregateFunctions collection.

    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
  4. gisela
    gisela avatar
    15 posts
    Member since:
    Feb 2006

    Posted 10 Sep 2014 in reply to Dimitrina Link to this post

    Hello Didie,

    the Aggregate Functions are defined in xaml, see attached Picture.


    Best regards
    Gisela


  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Sep 2014 Link to this post

    Hello Gisela,

    I tested defining column aggregates in XAML and then replacing the default GroupDescriptor with my own similarly to how you do so when the Grouping event is raised. The aggregates are still calculated fine in my test project. I am testing with our latest official version: 2014.2 729. 

    Would you please open a new support thread and attach a demo project illustrating the issue there? You can take a look at this blog post for a reference on how to isolate an issue. 

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