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
The recommended way is to call the CalculateAggregates() method. of RadGridView.
Kind regards,
Pavel Pavlov
the Telerik team
Can we expect the grid to call CalculateAggregates automatically in a future release? (For only the groups that need calculating)?
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
After a PropertyChanged calling CalculateAggregates does not update the GroupFooters. Only Rebind works
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
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)).
To attach the sample application you need to open a support ticket. Thank you.
Sincerely yours,
Yordanka
the Telerik team
Thanks!
EDIT: Oh just realised this is the silverlight thread - I'm using WPF... still was the problem found?
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>
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.
Can you post more info about the grid version at your end? Have you tried our latest build?
Sincerely yours,Vlad
the Telerik team
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>
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
