Group footer's aggregate values not shown

33 posts, 0 answers
  1. project30
    project30 avatar
    5 posts
    Member since:
    Apr 2007

    Posted 18 Jun 2010 Link to this post

    I'm displaying a group's footer and I wish to display aggregate values in it (see first image attached).  When I use the drag/drop feature, everything's fine.  However, when I use the drop-down as in image 2 attached, the aggregate values are not displayed in each group's footer (however, it's still displayed in the grid's footer itself).

    Here's the code that's executed when the user selects a value in the drop down :

            private void CreateGroup(string member, string displayContent) 
            { 
                this.RosterRecordGrid.GroupDescriptors.Clear(); 
     
                var descriptor = new Telerik.Windows.Data.GroupDescriptor(); 
                descriptor.Member = member; 
                descriptor.SortDirection = ListSortDirection.Ascending; 
                descriptor.DisplayContent = displayContent; 
     
                this.RosterRecordGrid.GroupDescriptors.Add(descriptor); 
            } 
     

    Here's the xaml:

            <pc:CustomDataGrid 
                Grid.Row="3" 
                x:Name="RosterRecordGrid"                  
                ItemsSource="{Binding Path=Entities}"                  
                AutoExpandGroups="True" 
                AutoGenerateColumns="False"  
                FrozenColumnCount="7"  
                CanUserFreezeColumns="False"  
                CanUserDeleteRows="False"  
                CanUserInsertRows="False"  
                CanUserReorderColumns="False"  
                CanUserResizeColumns="False"  
                CanUserSortColumns="False" 
                ShowColumnFooters="True" 
                ShowGroupFooters="True" 
                ShowInsertRow="False" 
                IsBusy="{Binding BusyIndicator.IsBusy}"
                <r:RadGridView.Columns> 
                    <r:GridViewDataColumn Header="Client" DataMemberBinding="{Binding Path=ClientFullName}" > 
                        <r:GridViewDataColumn.AggregateFunctions> 
                            <telerik:CountFunction ResultFormatString="{}Total clients: {0}" /> 
                        </r:GridViewDataColumn.AggregateFunctions> 
                    </r:GridViewDataColumn> 
                    <r:GridViewDataColumn Header="Service" DataMemberBinding="{Binding Path=ServiceUuid, Converter={StaticResource lookupConverter}, ConverterParameter=Services}"
                    </r:GridViewDataColumn> 
                    <r:GridViewDataColumn Header="Fund Identifier" DataMemberBinding="{Binding Path=FundIdentifierUuid, Converter={StaticResource lookupConverter}, ConverterParameter=FundIdentifiers}"
                    </r:GridViewDataColumn> 
                    <r:GridViewDataColumn Header="Subservice" DataMemberBinding="{Binding Path=SubserviceUuid, Converter={StaticResource lookupConverter}, ConverterParameter=Subservices}"
                    </r:GridViewDataColumn> 
                    <r:GridViewDataColumn Header="Place of Service" DataMemberBinding="{Binding Path=PlaceOfServiceCode, Converter={StaticResource lookupConverter}, ConverterParameter=PlacesOfService}"
                    </r:GridViewDataColumn> 
                    <r:GridViewDataColumn Header="Unit Price" DataMemberBinding="{Binding Path=UnitPrice}"
                    </r:GridViewDataColumn> 
                    <r:GridViewDataColumn Header="Total Units" DataMemberBinding="{Binding Path=TotalUnits}" CellTemplateSelector="{StaticResource selector}"
                        <r:GridViewDataColumn.AggregateFunctions> 
                            <telerik:SumFunction SourceField="TotalUnits" ResultFormatString="{}Total units: {0}" /> 
                        </r:GridViewDataColumn.AggregateFunctions> 
                    </r:GridViewDataColumn> 
                </r:RadGridView.Columns> 
            </pc:CustomDataGrid> 
     

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 22 Jun 2010 Link to this post

    Hi project30,

     
    This is the expected behavior, as the column aggregates are shown only when grouping by the UI. In your project when adding a group descriptor programmatically at run time, you need also to define the column's functions in the code - in your case in the method CreateGroup. For example:

    CountFunction f = new CountFunction();
    ( ( GridViewDataColumn )this.radGridView.Columns[ "ID" ] ).AggregateFunctions.Add( f );


    Kind regards,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. project30
    project30 avatar
    5 posts
    Member since:
    Apr 2007

    Posted 22 Jun 2010 Link to this post

    Super, thanks Maya
  5. project30
    project30 avatar
    5 posts
    Member since:
    Apr 2007

    Posted 22 Jun 2010 Link to this post

    No... It's not working.  I did like you said, and the footer is still absent (with or without the call to Clear):

            private void CreateGroup(string member, string displayContent) 
            { 
                this.RosterRecordGrid.GroupDescriptors.Clear(); 
     
                var descriptor = new Telerik.Windows.Data.GroupDescriptor(); 
                descriptor.Member = member; 
                descriptor.SortDirection = ListSortDirection.Ascending; 
                descriptor.DisplayContent = displayContent; 
                this.RosterRecordGrid.GroupDescriptors.Add(descriptor); 
     
                var column = this.RosterRecordGrid.Columns["TotalUnitsColumn"]; 
                //column.AggregateFunctions.Clear(); 
                var function = new SumFunction() { SourceField = "TotalUnits", ResultFormatString = "{}Total units: {0}" }; 
                column.AggregateFunctions.Add(function); 
            } 
     

    Note that the GroupDescriptor works as expected.
  6. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 23 Jun 2010 Link to this post

    Hello project30,

    You need to add your function to the AggregateFunctions of the GroupDescriptor

    private void CreateGroup(string member, string displayContent)
           { ...
               var descriptor = new Telerik.Windows.Data.GroupDescriptor();
               var function = new SumFunction() { SourceField = "TotalUnits", ResultFormatString = "{}Total units: {0}" };
               column.AggregateFunctions.Add(function);
               descriptor.AggregateFunctions.Add(function);
           }
    .
      


    Regards,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Karthikeyan
    Karthikeyan avatar
    3 posts
    Member since:
    Mar 2009

    Posted 07 Jul 2010 Link to this post

    We are facing the exact problem and your solution doesnot work.
    When we group by using the UI, we get the expected result. but not when grouping using the code CreateGroup().

    Any suggestion/solution is highly appreciated.

    Thanks,

    Karthik
  8. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 07 Jul 2010 Link to this post

    Hi Karthikeyan,

    Please paste me your code , and I will make the modifications necessary .

    Sincerely yours,
    Pavel Pavlov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Karthikeyan
    Karthikeyan avatar
    3 posts
    Member since:
    Mar 2009

    Posted 07 Jul 2010 Link to this post

    The field3 is numeric value. We need to display the sum aggregate of the field3 in the group footer. The grid is grouped by the field1. The code for Grouping and the XAML is provided below.

            public void ChangeGroup() 
            { 
                // Do not show the grouped column in the view 
                RadGridView1.Columns[0].IsVisible = false
     
                RadGridView1.GroupDescriptors.Clear(); 
                var descriptor = new Telerik.Windows.Data.GroupDescriptor(); 
                descriptor.Member = "field1"
                descriptor.DisplayContent = "field1"
     
                this.Dispatcher.BeginInvoke(new Action(() => this.RadGridView1.GroupDescriptors.Add(descriptor)));  
                 
                var column = this.RadGridView1.Columns[2]; 
                var function = new SumFunction() { SourceField = "field3", ResultFormatString = "{}{0}" }; 
                column.AggregateFunctions.Add(function); 
                descriptor.AggregateFunctions.Add(function); 
            } 

            <telGrid:RadGridView x:Name="RadGridView1" AutoGenerateColumns="False" CanUserResizeColumns="False" 
                                             CanUserReorderColumns="True" AutoExpandGroups="True" RowDetailsVisibilityMode="VisibleWhenSelected" 
                                             ShowGroupPanel="True" IsFilteringAllowed="False" RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False" AreRowDetailsFrozen="False" 
                                             ShowGroupFooters="True" 
                                             Background="White" VerticalAlignment="Top" Margin="0 10 0 0" Grid.ColumnSpan="2"
                <telGrid:RadGridView.Columns> 
                    <telGrid:GridViewDataColumn DataMemberBinding="{Binding field1}" Header="field1" IsReadOnly="True" Width="285" IsVisible="False"
                    </telGrid:GridViewDataColumn> 
                    <telGrid:GridViewDataColumn DataMemberBinding="{Binding field2}" Header="field2" IsReadOnly="True" Width="285"></telGrid:GridViewDataColumn> 
                    <telGrid:GridViewDataColumn DataMemberBinding="{Binding field3}" Header="field3" IsReadOnly="True" Width="135"
                        <telGrid:GridViewDataColumn.AggregateFunctions> 
                            <telData:SumFunction SourceField="field3" /> 
                        </telGrid:GridViewDataColumn.AggregateFunctions> 
                    </telGrid:GridViewDataColumn> 
                    <telGrid:GridViewDataColumn DataMemberBinding="{Binding field4}" Header="field4" IsReadOnly="True" Width="135"></telGrid:GridViewDataColumn> 
                </telGrid:RadGridView.Columns> 
            </telGrid:RadGridView> 

    Thanks

    Karthik
  10. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 12 Jul 2010 Link to this post

    Hello Karthikeyan,

    You need to change the definition of the property ResultFormatString. As you are setting it in the code-behind, the proper way of doing it is as follows:

    var function = new SumFunction()
    { SourceField = "field3", ResultFormatString = "{0}" };


    Greetings,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Karthikeyan
    Karthikeyan avatar
    3 posts
    Member since:
    Mar 2009

    Posted 13 Jul 2010 Link to this post

    Thank you. It worked like a charm.

    - Karthik
  12. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 15 Apr 2011 Link to this post

    It doesn't for me.  I still see nothing in the Group footer.
    I need to see the C2 format and I tried this but still the cell in the Group Footer is empty

    I tried many things but this was my last attempt

    void rgvTest_AutoGeneratingColumn(object sender, Telerik.Windows.Controls.GridViewAutoGeneratingColumnEventArgs e)
    {
        if(e.Column.UniqueName == "Property2")
            e.Column.AggregateFunctions.Add(new SumFunction() { SourceField = "Property2", ResultFormatString = "{C2}" });
    }
  13. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 15 Apr 2011 Link to this post

    Hi Marc Roussel,

     Could you please try with the ResultFormatString set to "{0:C2}"?

    Regards,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  14. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 15 Apr 2011 Link to this post

    I tried, believe me I tried a lot of things and still nothing shown.  See screenshot :
  15. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 15 Apr 2011 Link to this post

    Hello Marc Roussel,

     Do you group by dragging the column header, or programmatically? Also, what version of our controls are you using?

    Greetings,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  16. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 15 Apr 2011 Link to this post

    I group programmatically and the version is the latest one
     

     

    rgvTest.GroupDescriptors.Add(new Telerik.Windows.Data.GroupDescriptor() { DisplayContent = "Test", Member = "Property1" });
  17. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 15 Apr 2011 Link to this post

    I tried without grouping by code but by the header and it's still empty
  18. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    I don't know what I'm doing wrong but here's the entire code along with a screenshot showing the result on IE 9

    void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
        Expression.Blend.SampleData.PrestiluxData.PrestiluxData p = new Expression.Blend.SampleData.PrestiluxData.PrestiluxData();
        rgvTest.ItemsSource = p.Collection;
        rgvTest.ShowGroupFooters = true;
        rgvTest.AutoGenerateColumns = true;
        rgvTest.AutoGeneratingColumn += new EventHandler<GridViewAutoGeneratingColumnEventArgs>(rgvTest_AutoGeneratingColumn);
          
        rgvTest.GroupDescriptors.Add(new Telerik.Windows.Data.GroupDescriptor() { DisplayContent = "Test", Member = "Property1" });
        rgvTest.AutoExpandGroups = true;
    }
      
    void rgvTest_AutoGeneratingColumn(object sender, Telerik.Windows.Controls.GridViewAutoGeneratingColumnEventArgs e)
    {
        GridViewDataColumn column = e.Column as GridViewDataColumn;
      
        if (column.DataType == typeof(double))
            column.DataFormatString = "{0:C2}";
      
        if (e.Column.UniqueName == "Property2")
        {
            var descriptor = new Telerik.Windows.Data.GroupDescriptor();
            var function = new SumFunction() { SourceField = e.Column.UniqueName, ResultFormatString = "{0}" };
            column.AggregateFunctions.Add(function);
            descriptor.AggregateFunctions.Add(function);
        }
    }
  19. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    As you can see in the code, it's all experimentations based on what I'm reading in this thread.  I know the code isn't right but I'm trying hard to know why the Group footer isn't showing something.
  20. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    Maybe I'm not on the right thread.  I'm thinking that what I want is to have Sumfunction for every columns on the grid shown on the Group footer.
  21. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    I'm searching the entire GridView forum and to date I've not been able to make it work.  The Group footer is always empty
  22. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 18 Apr 2011 Link to this post

    Hi Marc Roussel,

     Could you please try to use our ColumnGroupDescriptor instead? It should inherit all AggregateFunctions from its Column.

    All the best,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  23. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    Where is that based on the code I shown ?
    I'm unable to figure out where I find this ColumnGroupDescriptor
  24. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 18 Apr 2011 Link to this post

    Hello Marc Roussel,

    if (e.Column.UniqueName == "Property2"
        
            var descriptor = new Telerik.Windows.Controls.GridView.ColumnGroupDescriptor();
            descriptor.Column = column;
            var function = new SumFunction() { SourceField = e.Column.UniqueName, ResultFormatString = "{0}" }; 
            column.AggregateFunctions.Add(function); 
        }

    Greetings,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  25. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    The type or namespace name 'ColumnGroupDescriptor' does not exist...
  26. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    2010.2.924.1040
  27. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 18 Apr 2011 Link to this post

    Hi Marc Roussel,

     I apologize for the confusion, you said you used the latest version of the controls a bit earlier in this thread. Could you please open a separate support ticket for this issue and attach your complete application?

    Kind regards,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  28. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    Done

    Thank you for submitting your inquiry to the Telerik Support.

    Your ticket ID is: 415354 (view all your support tickets)


  29. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 18 Apr 2011 Link to this post

    Hello Marc Roussel,

     It appears that this was an issue with initial grouping in our Q2 release. I suggest to use a newer release and use ColumnGroupDescriptor, as I advised you earlier.

    Best wishes,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  30. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2011 Link to this post

    See my support ticket.
  31. tony
    tony avatar
    7 posts
    Member since:
    Oct 2010

    Posted 09 Jun 2011 Link to this post

    Hi,

    I'm also experiencing the same behavior where my group footers are not rendering. If i manually group/ungroup it, the aggregates will come back.

    I have updated my telerik to the newest version at this time: 2011.1.419.1040

    I've also tried using the ColumnGroupDescriptors with no avail.

    I add the GroupDescriptors during the initialization of my view (in the constructor).

    CounterPartyExposureView.GroupDescriptors.Clear();
    ColumnGroupDescriptor gd = new ColumnGroupDescriptor();
    gd.Column = CounterPartyExposureView.Columns[4];
    CounterPartyExposureView.GroupDescriptors.Add(gd);

    I have also tried grouping in the xaml instead and played around with a few things.

    Tony
Back to Top
DevCraft banner