Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2090
XamDataGrid summarydefinition in hierarchy
posted

Hello,

I am using a XamDatagrid to display hierarchical data. This is done by using two different field Layouts - one for parent row and one for Children. Parent row = week and child row = one record per day.

Is it possible to have a summary definition per week and a total summary for the whole datagrid? Currently the summary per week is working fine but the total summary does not.

The XAML code below shows both field definitions.

Thanks

Niko

       <igDP:XamDataGrid.FieldLayouts>
        <igDP:FieldLayout Key="Woche" >
         <igDP:FieldLayout.SummaryDefinitions>
          <igDP:SummaryDefinition StringFormat="{}{1} = {0:#,##0.00;;}" Key="VerplanteStunden" SourceFieldName="VerplanteStunden" Calculator="Sum" />
         </igDP:FieldLayout.SummaryDefinitions>
         <igDP:Field Label="Woche" Name="Woche" IsReadOnly="True" AllowEdit="False" />
         <igDP:UnboundField Label="Datum" Name="Datum" IsReadOnly="True" AllowEdit="False" DisallowModificationViaClipboard="True"  />
         <igDP:UnboundField Label="Wochentag" Name="Wochentag" IsReadOnly="True" AllowEdit="False" DisallowModificationViaClipboard="True" />
         <igDP:Field Label="Mitarbeiter pro Werktag" Name="Mitarbeiteranzahl" >
          <igDP:Field.Settings>
           <igDP:FieldSettings EditAsType="{x:Type sys:Double}" EditorType="{x:Type igEditors:XamNumericEditor}">
            <igDP:FieldSettings.EditorStyle>
             <Style TargetType="{x:Type igEditors:XamNumericEditor}">
              <Setter Property="Mask" Value="nn.nn" />
             </Style>
            </igDP:FieldSettings.EditorStyle>
           </igDP:FieldSettings>
          </igDP:Field.Settings>
         </igDP:Field>
         <igDP:Field Label="Verplante Stunden" Name="VerplanteStunden" IsReadOnly="True" Format="###.##h;;#">
          <igDP:Field.Settings>
           <igDP:FieldSettings AllowSummaries="True" />
          </igDP:Field.Settings>
         </igDP:Field>
         <igDP:Field Name="Tage"/>
        </igDP:FieldLayout>
        <igDP:FieldLayout>
         <igDP:FieldLayout.Settings>
          <igDP:FieldLayoutSettings LabelLocation="Hidden"/>
         </igDP:FieldLayout.Settings>
         <igDP:FieldLayout.SummaryDefinitions>
          <igDP:SummaryDefinition StringFormat="{}{1} = {0:#,##0.00;;}" Key="VerplanteStunden" SourceFieldName="VerplanteStunden" Calculator="Sum" />
         </igDP:FieldLayout.SummaryDefinitions>
         <igDP:Field Label="Woche" Name="Woche" IsReadOnly="True" AllowEdit="False" AllowRecordFiltering="False" />
         <igDP:Field Label="Datum" Name="Datum" IsReadOnly="True" AllowEdit="False" AllowRecordFiltering="False" />
         <igDP:Field Label="Wochentag" Name="Wochentag" IsReadOnly="True" AllowEdit="False" AllowRecordFiltering="False" />
         <igDP:Field Label="Mitarbeiter pro Werktag" Name="Mitarbeiteranzahl" AllowRecordFiltering="False" >
          <igDP:Field.Settings>
           <igDP:FieldSettings EditAsType="{x:Type sys:Double}" EditorType="{x:Type igEditors:XamNumericEditor}">
            <igDP:FieldSettings.EditorStyle>
             <Style TargetType="{x:Type igEditors:XamNumericEditor}">
              <Setter Property="Mask" Value="nn.nn" />
              <Setter Property="PromptChar" Value="" />
             </Style>
            </igDP:FieldSettings.EditorStyle>
           </igDP:FieldSettings>
          </igDP:Field.Settings>
         </igDP:Field>
         <igDP:Field Label="Verplante Stunden" Name="VerplanteStunden" IsReadOnly="True" Format="###.##h;;#" AllowRecordFiltering="False">
          <igDP:Field.Settings>
           <igDP:FieldSettings AllowSummaries="True" />
          </igDP:Field.Settings>
         </igDP:Field>
        </igDP:FieldLayout>
       </igDP:XamDataGrid.FieldLayouts>
  • 34810
    Offline posted

    Hello Nikolaus,

    I have been investigating your requirement in this case to have a “global total” summary in the XamDataGrid, and currently, this is not built-in to the XamDataGrid. The summaries of the XamDataGrid are on a “per-island” band – that is, they will apply to each child “island” in the grid and the parent island, but they will not traverse the entirety of the grid.

    The best thing I can recommend to achieve this is to use external summary calculations in the grid. This can be done by using the QuerySummaryResult event of the XamDataGrid, which will allow you to essentially view your data and summarize it manually. You can read further about usage of external summary calculations at this topic.

    If you would like to see a “grand summary” type of functionality added to the XamDataGrid, I would recommend suggesting a new product idea for this at our WPF Ideas Site. This will place you in direct communication with our product management teams who plan and prioritize upcoming features and development based on community and user feedback.

    Please let me know if you have any other questions or concerns on this matter.