Group Cell Renderer

Group cell renderer is an AG Grid Enterprise feature, so you’ll need a license key to use it. See Using AG Grid Enterprise for an example of how to use your license key with Dash AG Grid components.

If you are grouping in the grid, then you will need to provide a group cell renderer as the group cell renderer is what provides the user with the expand and collapse functionality.

The key for the group cell renderer is agGroupCellRenderer. The grid’s group cell renderer takes many parameters to configure it. Here is an example of a column and its configuration:


    columnDefs= [
        # column definition configured to show group values with the cell renderer set to 'group'
        {
            "showRowGroup": True,
            "cellRenderer":'agGroupCellRenderer',
            # provide extra params to the cellRenderer
            'cellRendererParams': {
                # turn off the row count
                'suppressCount': true,
                # turn off double click for expand
                'suppressDoubleClickExpand': True,
                # enable checkbox selection
                'checkbox': True,
                # provide an inner renderer
                'innerRenderer': 'myInnerRenderer',
                # provide an inner renderer
                'innerRendererParams': {'foo': 'bar'},
                # provide a footer value getter
                'footerValueGetter': 'myFooterValueGetter'
            }
        }
    ]

The full set of parameters for the group cell renderer are defined on GroupCellRendererParams

Below is an example of configuring a group cell renderer. The example setup is not realistic as it has many columns configured for showing the groups. The reason for this is to demonstrate different group column configurations side by side. In your application, you will typically have one column for showing the groups.

The example is built up as follows:

<grid-example><grid-example>

For the example above to work, you’ll need to add the following to the dashAgGridComponentFunctions.js file in your assets folder:

var dagcomponentfuncs = (window.dashAgGridComponentFunctions =
    window.dashAgGridComponentFunctions || {});


dagcomponentfuncs.SimpleCellRenderer = function (props) {
    return React.createElement(
        'span',
        {
            style: {
                backgroundColor: props.node.group ? 'coral' : 'lightgreen',
                padding: 2,
            },
        },
        props.value
    );
};