Hmm, my code seems to work?
import dash_ag_grid as dag
from dash import Dash, html, Input, Output
import pandas as pd
app = Dash(
__name__
)
df = pd.read_csv('Book1.csv')
columnDefs = [{'field': i} for i in df.columns]
for i in range(1):
columnDefs[i]['rowGroup'] = True
columnDefs[i]['hide'] = True
columnDefs[-1]['aggFunc'] = 'sum'
columnDefs[-1]['valueFormatter'] = {"function": "params.group ? d3.format('(,.0f')(params.node.aggData[params.column.colId]) : (params.value ? d3.format('(,.0f')(params.value) : null)"}
columnDefs[-1]['cellStyle'] = { "styleConditions": [{"condition": "params.value ? params.value < 0 : false", "style": {"color": "salmon"}},
{"condition": "params.group ? params.node.aggData[params.column.colId] < 0 : false", "style": {"color": "salmon"}}] }
app.layout = html.Div(
[
dag.AgGrid(
id="grid",
columnDefs=columnDefs,
rowData=df.to_dict('records'),
enableEnterpriseModules=True,
dashGridOptions={"suppressAggFuncInHeader": True,}
),
]
)
app.run(debug=True)