-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Labels
P2considered for next cycleconsidered for next cyclebugsomething brokensomething brokencscustomer successcustomer success
Description
sample code:
import dash_ag_grid as dag
from dash import Dash, html
import dash_bootstrap_components as dbc
import pandas as pd
import os
app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server
df = pd.read_csv(
"https://raw.githubusercontent.com/plotly/datasets/master/ag-grid/olympic-winners.csv"
)
columnDefs = [
# Row group by country and by year is enabled.
{
"field": "country",
"rowGroup": True,
"hide": True,
"suppressColumnsToolPanel": True,
},
{
"field": "sport",
"rowGroup": True,
"hide": True,
"suppressColumnsToolPanel": True,
},
{
"field": "year",
"pivot": True,
"hide": True,
"suppressColumnsToolPanel": True,
},
{
"field": "gold",
"filter": True,
"aggFunc": "sum",
"valueFormatter": {"function": "d3.format('(,.2f')(params.value)"},
"cellStyle": {
"styleConditions": [
{
"condition": f"params.value < 100",
"style": {"backgroundColor": "lightgreen"},
},
],
"defaultStyle": {"backgroundColor": "yellow"},
},
},
{"field": "silver", "filter": True, "aggFunc": "sum"},
]
app.layout = html.Div(
[
dag.AgGrid(
id="enterprise-aggregation-example",
columnDefs=columnDefs,
rowData=df.to_dict("records"),
defaultColDef=dict(
rowSelection="multiple",
suppressAggFuncInHeader=True,
),
dashGridOptions={"animateRows": False},
enableEnterpriseModules=True,
getRowStyle={
"styleConditions": [
{
"condition": "params.node.aggData ? params.node.aggData.gold < 3 : false",
"style": {"backgroundColor": "silver"},
}
]
},
),
]
)
if __name__ == "__main__":
app.run(debug=True)
Metadata
Metadata
Assignees
Labels
P2considered for next cycleconsidered for next cyclebugsomething brokensomething brokencscustomer successcustomer success

