Ticket T812316
Visible to All Users

grid control v16.1 - group summary with multiple cols and mode "alignbycolumns" displayed incorrectly when expanded

created 6 years ago

good morning,

when I group by multiple columns, the group summary is is displayed incorrectly when groups are expanded.

how can I fix this? the control is very trivial:

<dxg:GridControl x:Name="SettlementOrderGridControl"
                   ItemsSource="{Binding Items}"
                   SelectionMode="Row"
                   AutoGenerateColumns="AddNew"
                   AutoGeneratedColumns="SettlementOrderGridControl_OnAutoGeneratedColumns"
                   >

<dxg:GridControl.View>

<dxg:TableView Name="SettlementOrderTableView"
                     AllowScrollAnimation="True"
                     ShowGroupedColumns="True"
                     GroupSummaryDisplayMode="AlignByColumns"
                     UseAnimationWhenExpanding="False"
                     IsRowCellMenuEnabled="False"
                     AllowEditing="False"
                     AllowColumnFiltering="True"
                     AllowColumnMoving="True"
                     AllowGrouping="True"
                     IsGroupPanelMenuEnabled="False"
                     ShowGroupPanel="True"
                     ShowGroupFooters="False"
                     ShowTotalSummary="False"
                     NavigationStyle="Row"
                     />

</dxg:GridControl.View>

</dxg:GridControl>

private void SettlementOrderGridControl_OnAutoGeneratedColumns(object sender, RoutedEventArgs e)
    {
      GridControl gc = sender as GridControl;
      if (gc == null || gc.GroupSummary.Count > 0)
      {
        return;
      }

const string decimalDisplayFormat = "##,0.00";

foreach (GridColumn c in gc.Columns)
      {
        if (c.FieldType != typeof(decimal))
        {
          continue;
        }

c.EditSettings = new TextEditSettings()
        {
          DisplayFormat = decimalDisplayFormat,
        };

gc.GroupSummary.Add(new GridSummaryItem()
        {
          DisplayFormat = decimalDisplayFormat,
          SummaryType = SummaryItemType.Sum,
          FieldName = c.FieldName,
        });

gc.TotalSummary.Add(new GridSummaryItem()
        {
          DisplayFormat = decimalDisplayFormat,
          SummaryType = SummaryItemType.Sum,
          FieldName = c.FieldName,
        });
      }
    }

I'm looking forward to hearing from you.

best regards
ben

Answers approved by DevExpress Support

created 6 years ago

Hello,
This is a known issue which we fixed in version 16.1.6. See the Summary cells are misaligned in optimized mode thread for details. So, I suggest that you upgrade to version 16.1.6 or newer to resolve the issue.

Thanks,
Kirill

    Other Answers

    created 6 years ago

    Hello Kirill,

    I found a workaround and removed the check if the GroupedSummaryCollection is empty. Now I just clear the collections and add all the items again.

    It seems that there is no change management in the grids source code. I bound an datatable to the grid, the OnAuto… was fired, I fixed the first column to the left and filled the groupsummary. Then I added a new column, the event was fired again, I checked the first columns fixed state and it was None although I set it to left before… Somehow creepy…
    private void SettlementOrderGridControl_OnAutoGeneratedColumns(object sender, RoutedEventArgs e)
        {
          GridControl gc = sender as GridControl;
          if (gc == null)
          {
            return;
          }

    gc.GroupSummary.Clear();
          gc.TotalSummary.Clear();

    const string decimalDisplayFormat = "##,0.00";

    foreach (GridColumn c in gc.Columns)
          {
            if (c.FieldType != typeof(decimal))
            {
              continue;
            }

    c.EditSettings = new TextEditSettings()
            {
              DisplayFormat = decimalDisplayFormat,
            };

    gc.GroupSummary.Add(new GridSummaryItem()
            {
              DisplayFormat = decimalDisplayFormat,
              SummaryType = SummaryItemType.Sum,
              FieldName = c.FieldName,
            });

    gc.TotalSummary.Add(new GridSummaryItem()
            {
              DisplayFormat = decimalDisplayFormat,
              SummaryType = SummaryItemType.Sum,
              FieldName = c.FieldName,
            });
          }
        }

    best regards
    ben

      Comments (1)
      Kirill (DevExpress Support) 6 years ago

        Hello,
        I'm happy to hear that you've found a workaround.
        As for the issue with columns, as it's not related to the initial one, I've extracted it to a separate ticket on your behalf (T812699: GridControl's columns are recreated when a new column is added to the bound datatable). It has been placed in our processing queue and will be answered shortly.

        Thanks,
        Kirill

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.