Skip to content
Docs

Grouping Rows in the Data Grid

Grouping a 500-row table by column — Server-computed group counts: 399 published, 65 draft, 36 archived, with inline editing switched off while grouping is active.

Grouping rows in the data grid works by one or more columns, with group header rows whose counts and totals are computed on the server, not by summing the rows currently on the page. This keeps totals correct on large tables.

  • Collapsed view issues one grouped aggregate query returning group keys, a count, and configured sums — paginated over groups, not member rows.
  • Expanding a group fetches only that group’s member rows, with the group key merged into the active filter through the query-builder helpers. A NULL group key is its own labeled group, fetched with a _null filter (not _eq: null).

No total anywhere is computed client-side; TanStack’s client aggregation is not used for header values.

Grouping state round-trips through a gb URL parameter, mirroring the cf column-filter parameter: setting grouping updates the URL, and loading that URL restores the same grouping. There is no parallel component state driving the query, so switching tables clears grouping — no gb value from the previous table leaks into the new table’s query.

With an active column filter and grouping, the filter composes first and then the grouping, so totals match the filtered SQL.