Aggregations + footer totals
View sourceRoll up numeric columns into per-group and grand totals. sum / count / avg / min / max ship; custom reducers register through useAggregations.
Try this
Rows are grouped by Region; the Amount column shows a per-region sum on the group row and a grand total in the footer.
- Click a region group row to collapse — the per-region sum stays visible.
- Filter the customer column — totals recompute from the filtered set.
- Apply a range select — the status bar adds a selection-aggregation segment with the sum of the selected cells.
- The Status column shows a count instead of a sum because of
{ type: "count" }.
Built-in aggregations
- sum — numeric only. Skips non-finite values.
- count — non-null cells. Useful for status / category columns.
- avg — arithmetic mean of numeric cells; honours value getters.
- min / max — works on numbers and on lexicographic strings.
- custom — provide an
{ id, init, step, merge, finalise }reducer. The grid runs it once per group plus once for the grand total. SeeuseAggregationsfor a recipe.
Where totals show
- Group rows. Each collapsed/expanded group renders the per-group rollup in the corresponding cell.
- Footer row. The grand total renders as a sticky footer below the last data row, in the same column.
- Status bar. When the user has a range selected, the status bar adds a selection-aggregation segment with sum / count / avg of the selected cells. Composes with the existing footer.