Row Grouping - Grouped Rows

Summary

  • Grouped Rows are the rows created by each Row Grouped Column value
  • AdapTable extends Formatting and Styled Columns to Grouped Rows (with per-type defaults)
  • Layouts can use Full Width Group Rows (RowGroupDisplayType: groupRows) — a separate display mode from multi-column groups

Grouped Rows are the Rows created by AG Grid when Row Grouping.

There is one Grouped Row for each value in the Row Grouped Column.

Full Width Group Rows

AG Grid provides an option to render each grouped row as a single full-width row.

Caution

  • Full width rows take UI precedence over Aggs defined in TableAggregationColumns which are not displayed
  • The aggregations are still calculated by AG Grid but you cannot see them in the Grouped Row

AdapTable Layouts also offers this functionality by setting the RowGroupDisplayType property to groupRows.

Note

The AdapTable Layout is the single source of truth for full width rows and overrides what is set in AG Grid.

Hint

Setting RowGroupDisplayType at Layout level allows you to specify different behaviours for different Layouts

Full Width Grouped Rows
Fork
  • In this demo we create a Full Width Group Rows Layout with RowGroupDisplayType: groupRows
  • Accordingly, the Grouped Row takes the whole of the Row - and hides the aggregations we applied on 3 columns
  • The other Layout - Single Grouped Rows - has RowGroupDisplayType: single which allows the aggregations to be displayed
Try It Out
  • Switch Layouts in the Layout toolbar and compare how Grouped Rows look
  • Note that aggregations are configured on both Layouts but only visible on the multi layout

Displaying Content

Three Modules support Row Grouping by rendering their content in Grouped Rows:

ModuleOnly Columns with Aggregation
Format Column
Styled Column
Action Columns

Excluding Group Rows

By default, Format Columns and Action Columns render in Grouped Rows (and in Pivot Layouts).

Styled Columns can also render in Grouped Rows (depending on the Style - see below for full details).

To hide any module's content from group rows, set ExcludeGroupRows to true on that object's RowScope.

Hint

  • The RowScope object also has ExcludeDataRows, ExcludeSummaryRows, and ExcludeTotalRows
  • These properties allow you to define a Format Column or Styled Column that appears only in Grouped Rows

Format Columns

Format Columns will be automatically rendered in any Grouped Row cell that contains an Aggregation.

Hint

If this is not desired then set ExcludeGroupRows to true in the Format Column's RowScope property

Grouped Rows: Format Columns
Fork
  • This example demonstrates adding Format Columns to Grouped Rows in AdapTable
  • We row-group on Language Column, set many Columns to have a sum Aggregation
  • We provide 3 sets of Format Columns each with different exclusion rules:
    • Open PRsand Closed PRs have a Fore Color of blue and no exclusions (so is rendered in whole column)
    • Open Issues and Closed Issues have a Fore Color of yellow excludes regular rows (so is only rendered in Grouped Rows)
    • Github Stars and Github Watchers have a Fore Color of red and excludes Grouped Rows (so is only rendered in leaf / data Rows)
Try It Out
  • Remove an Aggregation for a Column and note how nothing will appear in that Column's Grouped Rows

Styled Columns

Most Styled Columns can render in Grouped Rows - in cells that contain an Aggregation.

Caution

If the Layout is set to Full With Grouped Rows, no Styled Columns are rendered (as there are no aggregations)

Grouped Row visibility is set via the RowScope property in the StyledColumn object.

Breaking Change

Prior to Version 23.0 the BadgeStyle had its own RowScope property which has now been removed

The actual Grouped Row behaviour varies depending on 2 factors:

  • the Styled Column Type
  • whether RowScope is explicitly set
Styled Column typeRowScope unset (default)RowScope set
BadgeRenders on Data, Group, Summary, and Total rowsEach Exclude flag controls that row kind
Gradient, Percent Bar, Icon, Bullet Chart, Rating, Range BarRenders on Data, Summary, and Total rows — not on Group rowsUnset Exclude flags mean include; set ExcludeGroupRows: true to hide on groups
SparklineData (leaf) rows onlyGroup, Summary, Total always excluded

Caution

This means that if the RowScope property is omitted, only Badge styles will render on group rows by default

Note

Cells which exclude a Styled Column will still show Format Columns (if configured)

Grouped Rows: Styled Columns
Fork
  • This demo has a Grouped Row with several aggregations and different behaviour for the various Styled Columns provided:
    • Badge on closed_issues_count — no RowScope (default): badge on data and group rows
    • Badge on open_pr_countRowScope.ExcludeDataRows: true: badge only on Grouped Rows
    • Badge on closed_pr_countRowScope.ExcludeGroupRows: true: badge only on leaf rows
    • Gradient on github_stars — no RowScope: default excludes group rows (aggregated value shown as plain text)
    • Percent Bar on open_issues_countRowScope: {} (explicit include): bar also drawn on Grouped Rows
    • Note: the Format Column on open_pr_count and closed_pr_count can be seen in the cells where badges are excluded

Action Columns

Action Columns are automatically rendered in all Grouped Row cells.

If this is not desired, then the ExcludeGroupRows option in the Action Column's rowScope property, can be used to exclude Grouped Rows from rending the Action Column.

Row Grouping: Action Columns in Grouped Rows
Fork
  • This example demonstrates adding Action Columns to Grouped Rows in AdapTable; we again row-group on Language Column
  • We provide 2 Action Columns each with different exclusion rules:
    • Change Theme - has no exclusions (so is rendered in whole column)
    • Add Star excludes Grouped rows (so is only rendered in leaf / data Rows)

Selecting Grouped Rows

By default, selecting a Grouped Row will select just that row only, and not any of the Group's leaf Rows.

However it is possible to change this behaviour to select all leaf rows or filtered leaf rows.

This is done via the GroupSelectMode property in the RowSelection section of a Layout.

Find Out More

See Configuring Row Selection In Layouts for more information