JavaScript Data GridRow Grouping - Group Rows

Enterprise

Full width group rows can be used to represent the group structure in the grid.

Enabling Group Rows

The example above demonstrates that both country and year are grouped. No group column is generated, instead using full width rows to display the group value cells.

Group Rows can be enabled by setting the groupDisplayType grid option to "groupRows" as shown below:

const gridOptions = {
    groupDisplayType: 'groupRows',

    // other grid options ...
}

Cell Renderer

The group rows use the agGroupCellRenderer component to display the group information, as well as the chevron control for expanding and collapsing rows.

This can be configured with several Group Renderer Properties using the groupRowRendererParams grid option. The example below removes the row count. Checkboxes are enabled for row selection with the checkboxLocation property.

The example above demonstrates the following configuration:

const gridOptions = {
    columnDefs: [
        { field: 'total', rowGroup: true, cellRenderer: CustomMedalCellRenderer },
        // ... other column definitions
    ],
    groupRowRendererParams: {
        suppressCount: true,
    },
    rowSelection: { 
        mode: 'singleRow', 
        checkboxLocation: 'autoGroupColumn',
    },

    // other grid options ...
}

Configurable Options

suppressPadding
boolean
Set to true to not include any padding (indentation) in the child rows.
suppressDoubleClickExpand
boolean
Set to true to suppress expand on double click.
suppressEnterExpand
boolean
Set to true to suppress expand on ↵ Enter
totalValueGetter
string | TotalValueGetterFunc
The value getter for the total row text. Can be a function or expression.
suppressCount
boolean
If true, count is not displayed beside the name.
innerRenderer
any
The renderer to use for inside the cell (after grouping functions are added)
innerRendererParams
any
Additional params to customise to the innerRenderer.
innerRendererSelector
Function
Callback to enable different innerRenderers to be used based of value of params.

Custom Inner Renderer

When using the group cell renderer, the agGroupCellRenderer component will inherit the grouped columns renderer and display this inside of the group cell, adjacent to any configured checkboxes, cell count, and the expand/collapse chevron control.

This inner renderer can be overridden with a Custom Cell Component by setting the innerRenderer and innerRendererParams properties on the groupRowRendererParams grid option.

The example above uses the following configuration to provide a custom inner renderer to the group column:

const gridOptions = {
    autoGroupColumnDef: {
        cellRendererParams: {
            innerRenderer: CustomMedalCellRenderer,
        },
    },

    // other grid options ...
}

Custom Cell Renderer

The Group Cell Renderer can be entirely replaced with a Custom Cell Component by setting the groupRowRenderer grid option.

The example above sets a custom cell renderer using the following configuration:

const gridOptions = {
    groupRowRenderer: CustomGroupCellRenderer,

    // other grid options ...
}

Next Up

Continue to the next section to learn about the Row Group Panel.