AG Grid group rows are rows the grid creates to represent grouped records; they show a group key, such as a country or year, and let users expand or collapse the records beneath it. To display groups as full-width rows rather than in a dedicated group column, enable row grouping and set groupDisplayType: 'groupRows'; row grouping is an AG Grid Enterprise feature.
What AG Grid means by group rows
A group row is not usually a record from your original data. It represents a collection of records that share a value in one or more columns. For example, if a sales grid groups by country, a group row might be labelled “Canada,” with the Canadian sales records shown as its children when expanded. If grouping is also applied to year, the grid can show nested country and year groups.
AG Grid builds these group nodes from your row data and the grouping configuration. A group node has information such as its key and child rows, but it should not be treated as if it necessarily has the same data object as an ordinary record. Code that reads row data should account for group nodes, especially in callbacks, custom renderers, and event handlers.
“Group rows” can also mean the particular display mode called groupRows. That mode places each group heading on a full-width row. It is different from the default-style arrangement in which group labels and expand controls appear in one or more ordinary columns.
How to enable grouping and group-row display
First mark one or more columns as grouping columns, then choose how the resulting groups should appear. For example, a country column can be grouped by default while a separate display option renders the group headings across the grid:
const gridOptions = {
columnDefs: [
{ field: 'country', rowGroup: true, hide: true },
{ field: 'year' },
{ field: 'sales', aggFunc: 'sum' }
],
groupDisplayType: 'groupRows'
};
In this configuration, the grid groups records by country and displays each country heading as a full-width group row. The `hide` setting keeps the source country column from appearing as a normal data column; it is a common choice when that field is represented by the group heading instead. The sales aggregation is optional: it tells the grid to calculate a sum for groups, rather than merely showing group headings.
You can also let users add or remove grouping through the grid’s column interface, depending on the application’s configuration. In a typical client-side setup, grouping columns can be enabled in the Columns tool panel or by dragging a column to the Row Groups area. Exact UI availability depends on which tool panels, menus, and column features the application enables.
What the different display modes do
The groupDisplayType setting determines where group information appears. The modes solve different layout needs; changing the mode affects presentation, not the underlying idea of grouping.
singleColumndisplays group levels in a single group column. It is compact and can be useful when users may group by several fields.multipleColumnsdisplays a separate group column for each grouping level. This can make nested levels more visible, at the cost of using more horizontal space.groupRowsrenders group headings as full-width rows. It avoids a dedicated group column and gives the group label room to stand out across the grid.customgives an application more control over which columns show group information, using column definitions configured for that purpose.
For example, a narrow operational table with one grouping level may work well with full-width group rows. A wide analytical table with several nested levels may be easier to scan with multiple group columns, because each level has a consistent place in the column layout. There is no universally best choice: consider the number of grouping levels, the width of the data, and whether users need group labels to remain visible beside individual values.
Expanding, collapsing, and nesting groups
Group rows act as navigation points through a hierarchy. Users can expand a group to see its children and collapse it to hide them. If there are multiple grouping columns, each level can contain groups at the next level, followed by leaf rows representing individual records. A country-and-year grouping, for instance, can show “Canada,” then “2025,” then the underlying transactions.
Applications can control the initial expanded state. The groupDefaultExpanded grid option specifies how many group levels should be open initially; a value of 0 starts with groups collapsed, and -1 expands all group levels. Expanding everything can be convenient for a small dataset, but it may create a very long initial view for a large one. Where the desired initial state depends on each group, an application can use the documented group-open callback rather than applying one rule to every group.
Expansion is also relevant to selection and navigation. A collapsed group hides its children from the current view, but does not delete those records. Applications should decide deliberately how selecting a group relates to selecting its child rows; selection behavior depends on the grid’s selection configuration. Do not infer that a hidden child record has been removed from the dataset just because it is not currently visible.
Group values, renderers, and useful summaries
A group row commonly shows the value used to form the group and a count of its children. You can customize the group-row renderer’s parameters to adjust details such as the displayed content, count, or other supported renderer options. For the full-width groupRows mode, configure the group-row renderer rather than assuming that a normal cell renderer on one data column controls the entire group heading.
Grouping and aggregation are related but distinct. Grouping organizes records into categories; aggregation calculates a summary for a group. For example, grouping sales records by country creates country groups, while summing a numeric sales column can show a total for each group. An aggregation does not replace the underlying records, and a group total should not be confused with a separate source-data row.
Useful choices depend on what the summary is meant to communicate:
- Use a sum for quantities or amounts where adding values is meaningful.
- Use a count when the number of records is more useful than their total.
- Use an average only when the average is appropriate for the data and is not misleading because of uneven group sizes.
- Leave aggregation off when group headings alone provide the needed navigation.
For instance, grouping orders by status and summing order value can help compare totals by status. Grouping by customer and averaging order value answers a different question and may obscure how many orders each customer placed. Choose summaries based on the question users need to answer, not simply because an aggregation is available.
When group rows are a good choice
Full-width group rows are particularly helpful when a group label is more important than preserving a fixed group column. A section heading can span the available width, remain visually distinct from ordinary records, and make a hierarchy feel more like a report. This can suit category summaries, departmental lists, or grouped schedules.
A group column may be a better fit when users need to compare several fields side by side, when they want to sort or resize the group column like other columns, or when persistent level-by-level alignment matters. Full-width headings use horizontal space differently: they emphasize the group boundary, but do not provide a conventional group-value cell alongside every child row.
Also consider the volume and shape of the data. Grouping a large number of unique values can create many headings without making the information easier to understand. Before enabling grouping broadly, check that the selected fields produce useful categories and that users can still find individual records using filtering or search features configured for the grid.
Common problems and checks
If group rows do not appear, check the configuration in a logical order. A display mode by itself does not create groups: at least one column must be configured for row grouping, and row grouping requires the Enterprise feature set. Also confirm that the application is using a row model and data setup that supports the grouping behavior it expects.
- The field appears twice: The grouped field may still be displayed as a regular column as well as in the group heading. Hide it if the duplicate presentation is not wanted.
- No useful group heading appears: Check that the grouping field contains the values you expect and that a custom renderer has not replaced or omitted the group value.
- Group rows show but totals do not: Group display does not automatically mean a numeric total is configured. Set an appropriate aggregation on the relevant value column if a summary is required.
- The initial screen is too long: Reduce the number of expanded levels or start groups collapsed, particularly when the dataset has many records.
- Callbacks fail on group nodes: Do not assume every row node represents an ordinary data record. Check whether the node is a group before relying on its data object or applying record-specific logic.
When data is loaded from a server-side source, grouping also depends on the row model’s server-side grouping contract and the server returning the data needed for requested groups. A display setting cannot compensate for a server response that does not provide the appropriate grouped rows or children. Consult the documentation for the specific row model and AG Grid version in use.
How group rows differ from tree data and detail rows
Grouping is derived from shared field values. If records have a country field, the grid can create a hierarchy based on that field without the source data explicitly storing a parent-child tree. Tree Data, by contrast, is intended for data that already has a hierarchical relationship, such as folders and subfolders or an organizational structure. Choose the model that matches the structure of the source data rather than using grouping simply because both views can look hierarchical.
Group rows are also different from master/detail rows. Group rows represent categories generated from a grouping rule; master/detail displays a related detail view for a particular master record. A group heading is therefore not just a record with an expanded detail panel. The distinction affects how data is configured and what users expect to see when they expand a row.
Frequently Asked Questions
What does groupDisplayType: 'groupRows' do?
It displays each row group as a full-width group row instead of putting the group label in a dedicated group column. You still need to configure at least one grouping column.
Do AG Grid group rows require Enterprise?
Yes. Row grouping is an Enterprise feature, so a Community-only setup does not gain grouping by setting the display option alone.
How do I show a total on a group row?
Configure an aggregation for the relevant value column, such as a sum for a numeric sales field. Grouping creates the category hierarchy; the aggregation specifies the calculation.
Can I expand all group rows by default?
Yes. Set groupDefaultExpanded to -1 to open every group level initially. For large datasets, opening only selected levels or starting collapsed may be easier to use.
Are group rows part of my original row data?
Normally, no. They are group nodes generated by the grid from the configured grouping fields. Code that handles rows should distinguish group nodes from ordinary data rows.
Related
- Find and Replace Highlight Color in Microsoft Word
- Find and Replace in Word: Open and Use the Dialog Box
- Find and Replace in Word: Steps, Options, and Tips
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Creating Labels in Microsoft Word: A Step-by-Step GuideTo create labels in Microsoft Word, open Mailings > Labels, choose the label size under Options, enter your…
- Compare Two Excel Sheets and Find Every DifferenceTo compare two Excel sheets, use a cell-by-cell formula when the rows line up, or match records by…
- How to Rank in Excel From Top to BottomTo rank values from highest to lowest in Excel, enter =RANK.EQ(B2,$B$2:$B$10,0) beside the first value, then fill the…
- Adding a Checkbox in Google Sheets: Steps and UsesTo add a checkbox in Google Sheets in a web browser, select the cell or range where you…
- Merge Cells in Excel: The Easy Way and Safer OptionsThe easiest way to merge cells in Excel for Microsoft 365 on Windows is to select the cells,…
- Different Ways to Group Rows in ExcelIn Excel for Microsoft 365 on Windows, the main ways to group rows are to create a collapsible…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.