# @salmonui/data-grid/engine/aggregates API reference

> 21 exported symbols of @salmonui/data-grid/engine/aggregates: 8 functions, 3 interfaces, 9 types and 1 constant.

Canonical: https://salmonui.dev/docs/reference/data-grid/engine-aggregates

```ts
import { … } from '@salmonui/data-grid/engine/aggregates';
```

## Functions

### aggregatedNumericColumns

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-aggregates/aggregatedNumericColumns

```ts
function aggregatedNumericColumns<Row>(query: DataQuery, columns: ColumnSnapshot<Row>): CompiledColumn<Row>[];
```

Non-string leaf columns the query aggregates (warmed together with the sort/group keys in one row pass).

### aggregatesForModel

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-aggregates/aggregatesForModel

```ts
function aggregatesForModel<Row>(model: RowModelSnapshot<Row>, g: number): AggregateValues | null;
```

Values of group `g` (or the totals for -1) as the final row model shows
them: with a page-wise scope and a paged view (or a paged ungrouped
model), only the page's rows count.

### computeAggregates

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-aggregates/computeAggregates

```ts
function computeAggregates<Row>(input: RowModelSnapshot<Row>, descriptors: readonly AggregateDescriptor[], columns: ColumnSnapshot<Row>, scope: AggregateScope, locale: string): AggregateResult;
```

Full computation over a row model (grouped when `input.groups` is set).

### getAggregateValues

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-aggregates/getAggregateValues

```ts
function getAggregateValues(result: AggregateResult, g: number): AggregateValues;
```

Aggregate values of a group (or of the totals for `g = -1`), cached per result.

### getRangeAggregateValues

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-aggregates/getRangeAggregateValues

```ts
function getRangeAggregateValues(result: AggregateResult, owner: object, slot: number, a: number, b: number): AggregateValues;
```

Aggregate values over data positions `[a, b)` (page-wise aggregates of a paged view).

### isLeaf

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-aggregates/isLeaf

```ts
function isLeaf(tree: GroupTree, g: number): boolean;
```

Whether `g` is a leaf group (deepest level).

### updateAggregates

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-aggregates/updateAggregates

```ts
function updateAggregates<Row>(previous: AggregateResult, input: RowModelSnapshot<Row>, descriptors: readonly AggregateDescriptor[], delta: RowDelta, locale: string): AggregateResult | null;
```

Incremental update after `updateGroupTree`: recomputes the changed leaf
groups from their rows and re-combines only their ancestor chains and the
totals. Null when a full computation is needed.

## Types

### BuiltInAggregateType

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-aggregates/BuiltInAggregateType

```ts
type BuiltInAggregateType = Exclude<AggregateType, 'custom'>;
```

## Re-exported entry points

- [@salmonui/data-grid/engine](https://salmonui.dev/docs/reference/data-grid/engine.md): 12 symbols: 1 function, 2 interfaces, 8 types and 1 constant
  `AGGREGATE_TYPES`, `AggregateInput`, `AggregateScope`, `AggregatesCommand`, `AggregatesMethods`, `AggregatesModule`, `AggregatesOptions`, `AggregatesSetCommand`, `AggregatesSetScopeCommand`, `AggregatesState`, `CustomAggregate`, `createAggregatesModule`
- [@salmonui/data-grid/engine/grouping](https://salmonui.dev/docs/reference/data-grid/engine-grouping.md): 1 symbol: 1 interface
  `AggregateResult`
