Skip to content

AggregatorRef

Since v0.1.1

Reference to an aggregation function for footer/group summaries.

Can be either:

  • A built-in aggregator name: 'sum', 'avg', 'min', 'max', 'count'
  • A custom function that calculates the aggregate value

Aggregators are not declared on a column directly — they are configured per field on the consumer (e.g. RowGroupRenderConfig.aggregators for group rows, keyed by column field name).

type AggregatorRef = string | (rows: unknown[], field: string, column: unknown) => unknown
// Built-in aggregator on a group row config
{ aggregators: { amount: 'sum' } }
// Custom aggregator function
{
aggregators: {
price: (rows, field) => {
const values = rows.map((r) => (r as any)[field]).filter((v) => v != null);
return values.length ? Math.max(...values as number[]) : null;
},
},
}
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt