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

Can't get sum to show in group footer

1 Answer 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Samuel
Top achievements
Rank 1
Samuel asked on 03 Feb 2014, 05:42 PM
I cannot get the sum for a column to show in the group footer.  It does show in the column footer.

I am grouping by a text property (Unit.AdvCd) but the totals I'm looking for are for an integer property (MissionQty).   My XAML is below.

I've tried specifying the aggregate function in the group descriptor but that didn't help either.

Thanks,  Sam.

001.<telerik:RadGridView Grid.Row="2"
002.                                       Grid.Column="1"
003.                                       Margin="5"
004.                                       HorizontalAlignment="Stretch"
005.                                       VerticalAlignment="Stretch"
006.                                       AlternateRowBackground="Gray"
007.                                       AutoExpandGroups="True"
008.                                       AutoGenerateColumns="False"
009.                                       Background="LightGray"
010.                                       BorderBrush="{StaticResource McpicTealBrush}"
011.                                       BorderThickness="0"
012.                                       CanUserDeleteRows="False"
013.                                       CanUserInsertRows="False"
014.                                       CanUserSelect="False"
015.                                       IsReadOnlyBinding="{Binding IsReadOnly}"
016.                                       ItemsSource="{Binding UnitList}"
017.                                       RowIndicatorVisibility="Collapsed"
018.                                       RowLoaded="RadGridView_RowLoaded"
019.                                       SelectionUnit="FullRow"
020.                                       ShowColumnFooters="True"
021.                                       ShowGroupFooters="True"
022.                                       ShowGroupPanel="False"
023.                                       telerik:StyleManager.Theme="Expression_Dark">
024.                      <telerik:RadGridView.SortDescriptors>
025.                          <telerik:SortDescriptor Member="Unit.UIC" SortDirection="Ascending" />
026.                      </telerik:RadGridView.SortDescriptors>
027.                      <telerik:RadGridView.GroupDescriptors>
028.                          <telerik:GroupDescriptor Member="Unit.AdvCd" />
029.                      </telerik:RadGridView.GroupDescriptors>
030. 
031.    <telerik:RadGridView.Columns>
032. 
033.                          <telerik:GridViewToggleRowDetailsColumn Width="Auto" />
034. 
035.                          <telerik:GridViewDataColumn Width="Auto"
036.                                                      DataMemberBinding="{Binding Unit.UIC}"
037.                                                      Header="UIC"
038.                                                      HeaderTextAlignment="Center"
039.                                                      IsFilterable="True"
040.                                                      IsReadOnly="True"
041.                                                      IsSortable="True"
042.                                                      ShowDistinctFilters="True"
043.                                                      ShowFieldFilters="False"
044.                                                      SortMemberPath="Unit.UIC" />
045. 
046.                          <telerik:GridViewDataColumn Width="Auto"
047.                                                      DataMemberBinding="{Binding Unit.AdvCd}"
048.                                                      Header="MSE"
049.                                                      HeaderTextAlignment="Center"
050.                                                      IsFilterable="True"
051.                                                      IsGroupable="True"
052.                                                      IsReadOnly="True"
053.                                                      IsSortable="True"
054.                                                      ShowDistinctFilters="True"
055.                                                      ShowFieldFilters="False"
056.                                                      SortMemberPath="Unit.AdvCd" />
057. 
058. 
059.                          <telerik:GridViewDataColumn Width="*"
060.                                                      DataMemberBinding="{Binding Unit.Name}"
061.                                                      Header="Name"
062.                                                      IsFilterable="False"
063.                                                      IsReadOnly="True"
064.                                                      IsSortable="True"
065.                                                      ShowDistinctFilters="False"
066.                                                      ShowFieldFilters="False"
067.                                                      SortMemberPath="Unit.Name" />
068. 
069.                          <telerik:GridViewDataColumn Width="Auto"
070.                                                      DataMemberBinding="{Binding Unit.IsDetachment}"
071.                                                      Header="Type"
072.                                                      IsFilterable="True"
073.                                                      IsReadOnly="True"
074.                                                      IsSortable="True"
075.                                                      ShowDistinctFilters="True"
076.                                                      ShowFieldFilters="False"
077.                                                      SortMemberPath="Unit.IsDetachment">
078.                              <telerik:GridViewDataColumn.CellTemplate>
079.                                  <DataTemplate>
080.                                      <TextBlock Foreground="White" Text="{Binding Unit.IsDetachment, Converter={StaticResource DetachmentToText}}" />
081.                                  </DataTemplate>
082.                              </telerik:GridViewDataColumn.CellTemplate>
083.                          </telerik:GridViewDataColumn>
084. 
085.                          <telerik:GridViewDataColumn Width="Auto"
086.                                                      DataMemberBinding="{Binding RatedQty}"
087.                                                      Header="OPFOR Qty"
088.                                                      IsFilterable="True"
089.                                                      IsReadOnly="True"
090.                                                      IsSortable="True"
091.                                                      ShowDistinctFilters="False"
092.                                                      ShowFieldFilters="True"
093.                                                      SortMemberPath="RatedQty"
094.                                                      TextAlignment="Right">
095.                              <telerik:GridViewDataColumn.AggregateFunctions>
096.                                  <telerik:SumFunction />
097.                              </telerik:GridViewDataColumn.AggregateFunctions>
098.                          </telerik:GridViewDataColumn>
099. 
100.                          <telerik:GridViewDataColumn Width="Auto"
101.                                                      DataMemberBinding="{Binding MissionQty}"
102.                                                      Header="Mission Qty"
103.                                                      IsFilterable="True"
104.                                                      IsReadOnly="False"
105.                                                      IsSortable="True"
106.                                                      ShowDistinctFilters="False"
107.                                                      ShowFieldFilters="True"
108.                                                      SortMemberPath="MissionQty"
109.                                                      TextAlignment="Right">
110.                              <telerik:GridViewDataColumn.AggregateFunctions>
111.                                  <telerik:SumFunction />
112.                              </telerik:GridViewDataColumn.AggregateFunctions>
113. 
114.                              <telerik:GridViewDataColumn.CellTemplate>
115.                                  <DataTemplate>
116.                                      <Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
117.                                          <Grid.ColumnDefinitions>
118.                                              <ColumnDefinition Width="Auto" />
119.                                              <ColumnDefinition Width="*" />
120.                                              <ColumnDefinition Width="Auto" />
121.                                          </Grid.ColumnDefinitions>
122.                                          <Image Grid.Column="0"
123.                                                 Width="20"
124.                                                 Height="20"
125.                                                 VerticalAlignment="Center"
126.                                                 Source="/Mcpic.MissionFramework.App;component/Assets/Lightning.png"
127.                                                 ToolTipService.ToolTip="Value was modified since last save."
128.                                                 Visibility="{Binding IsChanged,
129.                                                                      Converter={StaticResource BooleanToVisibility}}" />
130.                                          <TextBlock Grid.Column="1"
131.                                                     FontWeight="{Binding IsOverQty,
132.                                                                          Converter={StaticResource BooleanToBold}}"
133.                                                     Foreground="{Binding IsOverQty,
134.                                                                          Converter={StaticResource QtyToColor}}"
135.                                                     Text="{Binding MissionQty}"
136.                                                     TextAlignment="Right"
137.                                                     Visibility="{Binding IsNIINTracked,
138.                                                                          Converter={StaticResource BooleanToVisibility}}" />
139. 
140.                                          <TextBox Grid.Column="1"
141.                                                   Background="Transparent"
142.                                                   BorderBrush="Transparent"
143.                                                   BorderThickness="0"
144.                                                   FontWeight="{Binding IsOverQty,
145.                                                                        Converter={StaticResource BooleanToBold}}"
146.                                                   Foreground="{Binding IsOverQty,
147.                                                                        Converter={StaticResource QtyToColor}}"
148.                                                   MaxLength="10"
149.                                                   Text="{Binding MissionQty,
150.                                                                  Mode=TwoWay,
151.                                                                  ValidatesOnDataErrors=True,
152.                                                                  ValidatesOnExceptions=True,
153.                                                                  ValidatesOnNotifyDataErrors=True}"
154.                                                   TextAlignment="Right"
155.                                                   Visibility="{Binding IsNIINTracked,
156.                                                                        Converter={StaticResource InverseBooleanToVisibility}}" />
157. 
158.                                          <TextBlock Grid.Column="2"
159.                                                     VerticalAlignment="Center"
160.                                                     FontWeight="SemiBold"
161.                                                     Foreground="Orange"
162.                                                     Text="*"
163.                                                     ToolTipService.ToolTip="{Binding PendingQty,
164.                                                                                      StringFormat='New quantity pending approval: \{0\}'}"
165.                                                     Visibility="{Binding PendingQty,
166.                                                                          Converter={StaticResource NullToVisibility}}" />
167.                                      </Grid>
168.                                  </DataTemplate>
169.                              </telerik:GridViewDataColumn.CellTemplate>
170. 
171.                          </telerik:GridViewDataColumn>
172. 
173.                          <telerik:GridViewDataColumn Width="Auto"
174.                                                      DataMemberBinding="{Binding IsSubmitted}"
175.                                                      Header="Submitted"
176.                                                      IsFilterable="True"
177.                                                      IsReadOnly="True"
178.                                                      IsSortable="True"
179.                                                      ShowDistinctFilters="True"
180.                                                      ShowFieldFilters="False"
181.                                                      SortMemberPath="IsSubmitted">
182.                              <telerik:GridViewDataColumn.CellTemplate>
183.                                  <DataTemplate>
184.                                      <TextBlock Foreground="White"
185.                                                 Text="{Binding IsSubmitted,
186.                                                                Converter={StaticResource BooleanToYesNo}}"
187.                                                 TextAlignment="Center" />
188.                                  </DataTemplate>
189.                              </telerik:GridViewDataColumn.CellTemplate>
190.                          </telerik:GridViewDataColumn>
191. 
192. 
193.                      </telerik:RadGridView.Columns>
194. 
195.                  </telerik:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Samuel
Top achievements
Rank 1
answered on 04 Feb 2014, 07:28 PM
Figured it out... the group descriptor must be added programmatically (for some stupid reason).

         Public Sub New()
              InitializeComponent()
              Dim gd = New GroupDescriptor With {.Member = "Unit.AdvCd"}
              Me.UnitList.GroupDescriptors.Add(gd)
         End Sub
Tags
GridView
Asked by
Samuel
Top achievements
Rank 1
Answers by
Samuel
Top achievements
Rank 1
Share this question
or