Hey everyone,
is it possible to create a custom aggfunc for sub-groups within an aggrid table?
i.e as I want to see data either monthly (avg) or daily of item values, so I choose avg as my aggfunc within the table.
However I want to see the group sub-totals as sums of the item average (per time period) and not the average of all the values in the time period. Do I need to make a custom agg-func in JS to parse into the options builder? Or is this even possible?
gb = GridOptionsBuilder()
gb.configure_default_column(
resizable=True,
filterable=True,
sortable=True,
editable=False,
)
gb.configure_column(
field="value",
header_name="Value",
width=100,
type=["numericColumn","numberColumnFilter","customNumericFormat"], precision=0,
aggFunc='avg'
)
gb.configure_column(
field="subtype",
header_name="subtype",
width=100,
rowGroup=True,
hide=True
)
gb.configure_column(
field="item",
header_name="item",
width=100,
rowGroup=True,
)
gb.configure_column(
field="type",
header_name="dataType",
width=100,
pivot=True
)
gb.configure_column(
field="virtualYear",
header_name="year",
valueGetter='new Date(df.day).getFullYear()',
pivot=True,
#hide=True
)
gb.configure_column(
field="virtualMonth",
header_name="day month",
valueGetter="new Date(df.day).toLocaleDateString('en-US',options= {year:'numeric', month:'2-digit'})",
pivot=True
)
gb.configure_column(
field="day",
header_name="day",
width=100,
pivot=True,
)
gb.configure_grid_options(
tooltipShowDelay=0,
pivotMode=True,
)
g_opt = gb.build()
g_opt['groupIncludeTotalFooter'] = True
AgGrid(data, gridOptions=g_opt, height = 600)