The UltraWinGrid’s Summary Display Areas - When to use them effectively

Michael DiFilippo / Tuesday, December 8, 2015

The UltraWinGrid provides countless invaluable data-centric features and can be morphed into many types of views, layouts and styles as the end-user sees fit. When summarizing columns you have the ability to display the results in quite a few places. This article will list and illustrate the different display areas for when the grid is grouped and not grouped; to give you an understanding where the summaries will be positioned. 

The SummaryDisplayAreas property can be easily defined as a flagged enum for specifying where you need to position the summaries, in multiple locations simultaneously. There are only four possible locations for placement: 

1. At the footer of the root row collection of an ungrouped grid
2. At the end of each data row collection of a group-by row
3. At the footer of the group-by rows collection
4. Within each group-by row (to the right of the sorted column name)

Summary Footers are displayed in the following locations:

  1. Default.
    1. The row collections at the end of each group-by row
    2. The group-by row
    3. The root rows collection (ungrouped)
Example 1: Grouped rows
  1. Bottom
      1. The row collection at the end of each group-by row
      2. The root rows collection (ungrouped)

Example 2: Grouped rows
Example 2.1: Ungrouped rows
  
  1. BottomFixed
    1. The row collections at the end of each group-by row
    2. The root rows collection (ungrouped). The summary footer is fixed so it doesn’t get scrolled out of view.
Example 3: Ungrouped
  1. GroupByRowsFooter (This flag must be combined with either Top, TopFixed, Bottom or BottomFixed in order for it to have any effect)
    1. The row collections at the end of each group-by row
    2. The summary footer of the group-by row collection
    3. The root rows collection (ungrouped)
Example 4: Grouped rows
  1. HideDataRowFooters
    1. The row collections at the end of each group-by row
    2. The root row collection
  2. InGroupByRows
    1. The group-by row
  3. RootRowsFootersOnly (This flag must be combined with either Top, TopFixed, Bottom or BottomFixed in order for it to have any effect. When rows are not grouped this flag has no effect. Note that this does not have any effect on the workings of InGroupByRows option.InGroupByRows will still work the same way regardless of the value of this flag.)
    1. The root row collection
Example 5: Grouped Rows
  1. Top
    1. The row collection at the beginning of each group-by row
Example 6: Grouped rows
  1. TopFixed
    1. The root rows collection (ungrouped) at the beginning. The summary footer is fixed so it doesn’t get scrolled out of view.
Example 7: Ungrouped rows
  1. None
    1. Summaries is not displayed anywhere

*Row collections of the data are treated equally. Grand Totals (ungrouped rows) and Sub-totals (set of grouped rows).

You cannot hide summaries for a root row collection only you can manually toggle the ‘Default’ & ‘None’ states when the grid is either grouped or ungrouped.

  • First, handle the ‘AfterSortChange’ event on the UltraWinGrid
  • Second, perform a check on whether any column(s) in the current band’s is in the ‘SortedColumns’ collection
  • Third, check any columns found in the ‘SortedColumns’ collection is ‘IsGroupByColumn’.

Lastly, set the grid’s ‘SummaryDisplayAreas’ enum to ‘Default for each summary. *Note any summary left out and the footer will still be displayed.

void ultraGrid1_AfterSortChange(object sender, BandEventArgs e)
{
           foreach (UltraGridColumn col in e.Band.SortedColumns)
           {
               if (col.IsGroupByColumn == true)
               {                   
                   ultraGrid1.DisplayLayout.Bands[0].Summaries[0].SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.Default;
               } 
               else
               {
                   ultraGrid1.DisplayLayout.Bands[0].Summaries[0].SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.None;                   
               }
           }
}