View as Markdown

API reference: @salmonui/data-grid

DataGridAggregateContextinterface

import type { DataGridAggregateContext } from '@salmonui/data-grid';
interface DataGridAggregateContext<Row> {
    readonly field: string;
    readonly column: DataGridColumnInfo<Row> | undefined;
    readonly values: Readonly<Record<string, unknown>>;
    readonly formatted: Readonly<Record<string, string>>;
    readonly group: GroupRowSnapshot | null;
    readonly key: GroupRowSnapshot['key'] | null;
    readonly count: number;
    readonly aggregates: AggregateValues;
    readonly rows: () => readonly Row[];
}

Context of aggregate templates (renderFooter, renderGroupFooter, renderGroupCaption).

DataGridAggregateContext members (9)
NameSignatureDescription
fieldreadonly field: string;
columnreadonly column: DataGridColumnInfo<Row> | undefined;
valuesreadonly values: Readonly<Record<string, unknown>>;

Values of this column's aggregates by type ({ sum, average }).

formattedreadonly formatted: Readonly<Record<string, string>>;

Formatted values by type.

groupreadonly group: GroupRowSnapshot | null;

The group for group footers and captions; null in the grid footer.

keyreadonly key: GroupRowSnapshot['key'] | null;

key and count of the group. In the grid footer: null and the data rows the values cover (the page for aggregateScope: 'page', every matching row for 'all' or server aggregates).

countreadonly count: number;
aggregatesreadonly aggregates: AggregateValues;

Every aggregate of the group or grid.

rowsreadonly rows: () => readonly Row[];