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

[Solved] GroupFooters update

15 Answers 203 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MiddleTommy
Top achievements
Rank 1
MiddleTommy asked on 20 Jul 2010, 06:36 AM
I have noticed that the group footers and grid footer sums become out of date when the values in the grid cells change. In oher words they do not automatically update when values change in the items of a gridview. Also groups are not automatically updated when the values in the column being grouped is changed. I am now using ReBind() on the grid to update the data and groups. Is there another way or is this a bug?
 If I dont call rebind when I programatically add items to the ItemsSource (ObservableCollection) I would get two rows for every row that the grouped property changed on. One row with the grouped value 0 and the other with the new grouped value. I fixed this by changing the grouped value before adding the item to the grid. 

15 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 22 Jul 2010, 02:17 PM
Hi TWT,

The recommended way is to call the CalculateAggregates() method. of RadGridView.

Kind regards,
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
MiddleTommy
Top achievements
Rank 1
answered on 22 Jul 2010, 03:26 PM
Thanks.
Can we expect the grid to call CalculateAggregates automatically in a future release? (For only the groups that need calculating)?
0
Pavel Pavlov
Telerik team
answered on 22 Jul 2010, 03:57 PM
Hi TWT,

We were trying to implement such feature but fe found we would need to mess up with the logic of the Silverlight bindings. This may have more negative impact than benefit.
On the other hand for objects implementing the INotifyPropertyChanged interface there is a chance of some improvement . We are definitely going to research in that direction for some of our next official releases.

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
MiddleTommy
Top achievements
Rank 1
answered on 22 Jul 2010, 08:26 PM
My objects are WCF RIA Services Entities that implement INotifyPropertyChanged.
After a PropertyChanged calling CalculateAggregates does not update the GroupFooters. Only Rebind works
0
Pavel Pavlov
Telerik team
answered on 23 Jul 2010, 08:54 AM
Hello TWT,

This one sounds like a bug.  I will try to reproduce it here. How do you change the cell  values  - in code behind , or by user entry in cells ?

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
MiddleTommy
Top achievements
Rank 1
answered on 23 Jul 2010, 07:03 PM
I do it in both.
I have a sample app, where do I send it? I cant upload it here because it is not an image.

Run it and change the Hours. On the row end edit I call the calculateaggregates.

(Ah oops, it doesnt calculate overtime hours correctly but it still demonstrates the bug. To have ot or dt hours show(and not calculate) just enter more than 8 or 12 hours in a row(not in a day)).
0
Yordanka
Telerik team
answered on 26 Jul 2010, 04:11 PM
Hi TWT,

To attach the sample application you need to open a support ticket. Thank you.

Sincerely yours,
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
Geoff Smith
Top achievements
Rank 1
answered on 23 Aug 2010, 11:31 AM
Did you guys get anywhere with this? I'm also finding that CalculateAggregates() is not updating the group footer...

Thanks!

EDIT: Oh just realised this is the silverlight thread - I'm using WPF... still was the problem found?
0
Satrajit
Top achievements
Rank 1
answered on 23 Aug 2010, 02:05 PM
Hello,

I want to show the aggregate total in the column group footer.To do so, I am using the following code snippet from the code samples.

But it shows the totals in the grid footer and not in the column group footer.

Can you please help?

<grid:RadGridView Name="radGridView" ShowColumnFooters="True" AutoGenerateColumns="False" 
                                  AlternateRowBackground="Coral" Margin="0,150,328,0" HorizontalGridLinesBrush="Black" VerticalGridLinesBrush="Black" BorderBrush="Black" FontWeight="Bold"
                                  FontFamily="Arial" FontSize="11" VerticalAlignment="Top" HorizontalAlignment="Stretch" MaxColumnWidth="500" 
                                  DataLoadMode="Asynchronous" Height="600" RowHeight="15" ScrollMode="RealTime" Width="14000" GroupRowStyle="{StaticResource MyCustomGroupRowStyle}" ShowGroupFooters="True" ShowGroupPanel="True">  


<grid:GridViewDataColumn Header="Sales Revenue" DataMemberBinding="{Binding SALES_REVENUE}" IsReadOnly="False" HeaderTextAlignment="Center" UniqueName="SALES_REVENUE" DisplayIndex="26">

                            <grid:GridViewDataColumn.AggregateFunctions>

                                <data:SumFunction Caption="Sum (In LCY): "  SourceField="SALES_REVENUE" ResultFormatString="{}{0:N}"/>

                             </grid:GridViewDataColumn.AggregateFunctions>

                         </grid:GridViewDataColumn>


0
MiddleTommy
Top achievements
Rank 1
answered on 23 Aug 2010, 04:09 PM
Geoff, Its a bug they are working on
0
Geoff Smith
Top achievements
Rank 1
answered on 23 Aug 2010, 04:15 PM
Cool, thanks!
0
MB
Top achievements
Rank 1
answered on 25 Oct 2010, 04:07 PM

Any update on this?

I have noticed something similar - adding a groupdescriptor via code does not seem to consistently update the group column footers.  This seems to have something to do with sequencing, as when the page first starts up with saved group descriptors the group column footers do appear correctly.

Calling CalculateAggregates() and/or ReBind() has not helped in this case.
0
Vlad
Telerik team
answered on 26 Oct 2010, 07:19 AM
Hello MB,

 Can you post more info about the grid version at your end? Have you tried our latest build?

Sincerely yours,
Vlad
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
MB
Top achievements
Rank 1
answered on 26 Oct 2010, 01:58 PM
Actually I downloaded and tried Q3 beta yesterday - the funny thing is that now the problem is reversed (although a diff problem now).

Adding the grouping first (via code), then setting the data,now the GridView displays 2 group header rows per single group (one grouped under the other).  The top one displays aggregates, the second one does not.  See attached img.

Adding the grouping after the data is bound works great (opposite of before!).  Adding the group at either time is using the same method.

<code>

        void AddGroupDescriptor(string member, string sumsource)
        {

            SumFunction f = new SumFunction(){ ResultFormatString = "{0}"};
            GridViewDataColumn col = grid.Columns.OfType<GridViewDataColumn>().First(c => c.UniqueName == sumsource);
            col.AggregateFunctions.Add(f);

            ColumnGroupDescriptor gd = new ColumnGroupDescriptor();
            gd.Column = grid.Columns[member];
            grid.GroupDescriptors.Add(gd);         
        }
</code>

0
Yavor Georgiev
Telerik team
answered on 27 Oct 2010, 12:48 PM
Hello MB,

 Thank you for your feedback. We have isolated the cause of this faulty behavior and resolved it. You will be able to find the fix in our final Q3 release. I have also awarded you telerik points.

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
Tags
GridView
Asked by
MiddleTommy
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
MiddleTommy
Top achievements
Rank 1
Yordanka
Telerik team
Geoff Smith
Top achievements
Rank 1
Satrajit
Top achievements
Rank 1
MB
Top achievements
Rank 1
Vlad
Telerik team
Yavor Georgiev
Telerik team
Share this question
or