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

Group footer's aggregate values not shown

32 Answers 469 Views
GridView
This is a migrated thread and some comments may be shown as answers.
project30
Top achievements
Rank 1
project30 asked on 18 Jun 2010, 09:47 PM
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> 
 

32 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 22 Jun 2010, 08:13 AM
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
0
project30
Top achievements
Rank 1
answered on 22 Jun 2010, 01:00 PM
Super, thanks Maya
0
project30
Top achievements
Rank 1
answered on 23 Jun 2010, 02:08 AM
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.
0
Maya
Telerik team
answered on 23 Jun 2010, 02:47 PM
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
0
Karthikeyan
Top achievements
Rank 1
answered on 07 Jul 2010, 11:24 AM
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
0
Pavel Pavlov
Telerik team
answered on 07 Jul 2010, 11:44 AM
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
0
Karthikeyan
Top achievements
Rank 1
answered on 07 Jul 2010, 12:29 PM
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
0
Maya
Telerik team
answered on 12 Jul 2010, 12:10 PM
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
0
Karthikeyan
Top achievements
Rank 1
answered on 13 Jul 2010, 07:00 AM
Thank you. It worked like a charm.

- Karthik
0
Marc Roussel
Top achievements
Rank 2
answered on 15 Apr 2011, 04:09 PM
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}" });
}
0
Yavor Georgiev
Telerik team
answered on 15 Apr 2011, 04:14 PM
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
0
Marc Roussel
Top achievements
Rank 2
answered on 15 Apr 2011, 04:16 PM
I tried, believe me I tried a lot of things and still nothing shown.  See screenshot :
0
Yavor Georgiev
Telerik team
answered on 15 Apr 2011, 04:20 PM
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
0
Marc Roussel
Top achievements
Rank 2
answered on 15 Apr 2011, 04:20 PM
I group programmatically and the version is the latest one
 

 

rgvTest.GroupDescriptors.Add(new Telerik.Windows.Data.GroupDescriptor() { DisplayContent = "Test", Member = "Property1" });
0
Marc Roussel
Top achievements
Rank 2
answered on 15 Apr 2011, 04:25 PM
I tried without grouping by code but by the header and it's still empty
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 01:10 PM
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);
    }
}
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 01:17 PM
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.
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 01:19 PM
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.
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 01:37 PM
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
0
Yavor Georgiev
Telerik team
answered on 18 Apr 2011, 01:45 PM
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
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 01:46 PM
Where is that based on the code I shown ?
I'm unable to figure out where I find this ColumnGroupDescriptor
0
Yavor Georgiev
Telerik team
answered on 18 Apr 2011, 01:55 PM
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
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 01:57 PM
The type or namespace name 'ColumnGroupDescriptor' does not exist...
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 01:57 PM
2010.2.924.1040
0
Yavor Georgiev
Telerik team
answered on 18 Apr 2011, 02:00 PM
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
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 02:05 PM
Done

Thank you for submitting your inquiry to the Telerik Support.

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


0
Yavor Georgiev
Telerik team
answered on 18 Apr 2011, 02:27 PM
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
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 02:50 PM
See my support ticket.
0
tony
Top achievements
Rank 1
answered on 09 Jun 2011, 06:48 PM
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
0
Yordanka
Telerik team
answered on 13 Jun 2011, 08:33 AM
Hello tony,

Could you please check the attached sample project where the aggregates are shown correctly? Let me know in case I have missed something and the scenario for reproducing the problem is different.
 
Best wishes,
Yordanka
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
0
Chris
Top achievements
Rank 1
answered on 14 Jul 2011, 03:50 PM
I'm having the same problem. Oddly it works elsewhere but with a different type of datasource (QueryableCollectionView) and a RadDataPager. The one that doesn't work just uses an ObvervableCollection. The top level footers render fine, as do the items in the group row. It's the same whether I do it manually or via code (using a ColumnGroupDescriptor).

The only other difference I can think of is that some of the fields are editable in the one that doesn't work, but I can't see why that would be a problem.

I've attached a screenshot.

PS. I'm using 2011.1.419.1040, Q2 doesn't seem to have changed this but does seem to have broken other grouping related stuff.
0
Yordanka
Telerik team
answered on 19 Jul 2011, 02:50 PM
Hello Chris,

Could you isolate the problem in a sample project and send it to us (via support ticket) so we can check what is going wrong? Thank you in advance.
 
Regards,
Yordanka
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
project30
Top achievements
Rank 1
Answers by
Maya
Telerik team
project30
Top achievements
Rank 1
Karthikeyan
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Marc Roussel
Top achievements
Rank 2
Yavor Georgiev
Telerik team
tony
Top achievements
Rank 1
Yordanka
Telerik team
Chris
Top achievements
Rank 1
Share this question
or