This question is locked. New answers and comments are not allowed.
Hi,
I would like to display totals in the footer only when a particular column is set for grouping. For example, in my grid I have two columns, Currency and Amount. As it doesn't make sense to total Amount column when more than one currency symbol is involved, I would like to show totals only when we drag the Currency column to group the records by Currency and would like to see totals for each group and when the Currency column is removed from the Grouping then I would like to remove the totals row at the bottom. If it is possible to do this then could you please send me a sample code or advice me how to do it?
I really appreciate your help.
Thanks
Srinivas
I would like to display totals in the footer only when a particular column is set for grouping. For example, in my grid I have two columns, Currency and Amount. As it doesn't make sense to total Amount column when more than one currency symbol is involved, I would like to show totals only when we drag the Currency column to group the records by Currency and would like to see totals for each group and when the Currency column is removed from the Grouping then I would like to remove the totals row at the bottom. If it is possible to do this then could you please send me a sample code or advice me how to do it?
I really appreciate your help.
Thanks
Srinivas
4 Answers, 1 is accepted
0
Srinivas
Top achievements
Rank 1
answered on 29 Aug 2009, 04:18 AM
Hi,
If it is not possible as described in my previous post, is there any other alternate to achieve similar results?
Thanks
Srinivas
If it is not possible as described in my previous post, is there any other alternate to achieve similar results?
Thanks
Srinivas
0
Hello Srinivas,
I've attached small example to illustrate you how to achieve this using Grouped event. The code is relatively simple:
XAML
C#
Regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I've attached small example to illustrate you how to achieve this using Grouped event. The code is relatively simple:
XAML
| <UserControl x:Class="SilverlightApplication2.Page" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data" |
| xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"> |
| <Grid x:Name="LayoutRoot" Background="White"> |
| <telerik:RadGridView x:Name="RadGridView1" AutoExpandGroups="True" AutoGenerateColumns="False"> |
| <telerik:RadGridView.Columns> |
| <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding ID}" /> |
| <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}"> |
| <telerik:GridViewDataColumn.AggregateFunctions> |
| <telerikData:CountFunction /> |
| </telerik:GridViewDataColumn.AggregateFunctions> |
| </telerik:GridViewDataColumn> |
| </telerik:RadGridView.Columns> |
| </telerik:RadGridView> |
| </Grid> |
| </UserControl> |
C#
| namespace SilverlightApplication2 |
| { |
| public partial class Page : UserControl |
| { |
| public Page() |
| { |
| InitializeComponent(); |
| RadGridView1.ItemsSource = from i in Enumerable.Range(0, 10) |
| select new MyObject() |
| { |
| ID = i, |
| Name = String.Format("Name{0}", i) |
| }; |
| RadGridView1.Grouped += new EventHandler<GridViewGroupedEventArgs>(RadGridView1_Grouped); |
| } |
| void RadGridView1_Grouped(object sender, GridViewGroupedEventArgs e) |
| { |
| RadGridView1.ShowColumnFooters = RadGridView1.ShowGroupFooters = RadGridView1.GroupDescriptors.Where(d => d.Member == "Name").FirstOrDefault() != null; |
| } |
| } |
| public class MyObject |
| { |
| public int ID { get; set; } |
| public string Name { get; set; } |
| } |
| } |
Regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Srinivas
Top achievements
Rank 1
answered on 01 Sep 2009, 05:05 AM
Hello Vlad,
Thank you very much for the sample, it is working wonderful.
I still need one more help related to layout of the Gridview. I am using Hierarchy grid (header & details) where in collpase mode I see '+' sign at the beginning of each row. When I group a column (of the header) the footer section for each group starts right below the '+' sign which makes the footer column separator lines slightly off with the regular column separators and this makes the totals look unfriendly to the user. Is there any way we can push the footer to start from column one and not from the '+' sign? I can't paste the picture in this blog but try to explain with a sketch, hopefully they look nice when I post my message
+ | | | | | <- column separator
+ | | | | |
+ | | | | |
| | | | | <<== footer for the totals; the column separator starts below the '+' sign
+ | | | | |
+ | | | | |
| | | | | <<== footer for the totals; the column separator starts below the '+' sign
I would like my footer column separator to align with actual column separator.
Any help is appreciated.
Thanks
Srinivas
Thank you very much for the sample, it is working wonderful.
I still need one more help related to layout of the Gridview. I am using Hierarchy grid (header & details) where in collpase mode I see '+' sign at the beginning of each row. When I group a column (of the header) the footer section for each group starts right below the '+' sign which makes the footer column separator lines slightly off with the regular column separators and this makes the totals look unfriendly to the user. Is there any way we can push the footer to start from column one and not from the '+' sign? I can't paste the picture in this blog but try to explain with a sketch, hopefully they look nice when I post my message
+ | | | | | <- column separator
+ | | | | |
+ | | | | |
| | | | | <<== footer for the totals; the column separator starts below the '+' sign
+ | | | | |
+ | | | | |
| | | | | <<== footer for the totals; the column separator starts below the '+' sign
I would like my footer column separator to align with actual column separator.
Any help is appreciated.
Thanks
Srinivas
0
Hello Srinivas,
What you are experiencing is a bug in the indenting of the FooterRow and GroupFooterRow. It is in our backlog and the fix should be available in one of our upcoming weekly builds.
I apologize for the inconvenience.
Kind regards,
Kalin Milanov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
What you are experiencing is a bug in the indenting of the FooterRow and GroupFooterRow. It is in our backlog and the fix should be available in one of our upcoming weekly builds.
I apologize for the inconvenience.
Kind regards,
Kalin Milanov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
