Grouping
GroupingAggregationTemplate
The GroupingAggregationTemplate
type defines the structure of aggregation functions
that can be used for grouping in a RevoGrid.
/** * The `GroupingAggregationTemplate` type defines the structure of aggregation functions * that can be used for grouping in a RevoGrid. */export type GroupingAggregationTemplate = { aggregations?: { [key: string]: (values: any[]) => any };}
groupingAggregation
The groupingAggregation
function is a template for creating custom aggregation functions
that can be used for grouping in a RevoGrid.
This function takes a template object with an optional aggregations
property, which is a
key-value pair where the key is the column property name and the value is an aggregation function.
The aggregation functions receive an array of values and return a single aggregated result.
Example
const aggregations = { 'name': (values: string[]) => values.join(', ')}
const template: GroupLabelTemplateFunc = (h, props) => { return groupingAggregation(h, props, aggregations);}
const grid = document.createElement('revo-grid');grid.columns = [ { prop: 'name', name: 'Name', template: template }]
groupingAggregation: GroupLabelTemplateFunc;