Is there a way to add a custom aggregation function to a power grid.

In the ag-grid docs (https://www.ag-grid.com/javascript-grid/aggregation/

it explains that custom aggregation can be provided via the colDefs or by the gridApi.addAggFunc() method.

I am not sure how to do either.

My objective is to show in the group row (using a custom InnerRenderer - which is working fine) a result of a calculation of the ratio of A and B as a percentage. Where A = aggregate (sum of x ) and B = grand sum (of x).

I do have the A value but need to get the B value.

A custom aggregate function would sum the values of a column for all rows to get the grand sum. The result of this function is then available in the InnerRenderer for the ratio calculation.

I know how to get the cellRenderer and the InnerRenderer function into a string and assign that to the property in the grid. But I am not sure how to provide the custom aggregate function via the colDefs (since there is no custom Aggregate func property).

How have others done this?

I did think about adding a column to the dataset for the power grid that contains the grand sum for every row then using the MAX aggregate function to get at it during the InnerRenderer (it is the same value of course so max is just a way to get it) but that seems a waste!