Customize Default Aggregation Function Names in AG Grid

Viewed 26

In AG Grid when row grouping is applied, there is an option of "Value Aggregation" within the Column Menu. This option has a sub menu that lists the available aggregation functions ("sum", "min", "max", etc) along with custom aggregation functions defined on the grid.

The default aggregation functions displayed here are in lower case and abbreviated. I would like to have them in title case and not abbreviated.

Value Aggregation (default) Value Aggregation (required)
avg Average
count Count
first First
last Last

Is there anything available within the preferences or api to achieve this?

1 Answers

This is achievable by defining Custom Aggregation Functions

In this case I'm just passing original aggregation function, but you could define your own custom ones as well.

const gridOptions = {
  // ...Other grid options
  aggFuncs: {
    Average: (params) => params.api.aggFuncService.aggFuncsMap.avg(params),
    Count: (params) => params.api.aggFuncService.aggFuncsMap.count(params),
    First: (params) => params.api.aggFuncService.aggFuncsMap.first(params),
    Last: (params) => params.api.aggFuncService.aggFuncsMap.last(params),
  }
};

Here is a Plunker example:

https://plnkr.co/edit/GnC6spz2y516GW4b

Related