Building Dashboards with Dash and Plotly
Alex Scriven
Data Scientist
style
❌cellStyle
instead ✅grid = AgGrid(
defaultColDef={
"cellStyle":
{"textAlign": "right"}}
)
column_defs = [
{"field": "Major Category"
, "cellStyle": {"textAlign": "center"}},
{"field": "Total Sales ($)"
, "valueFormatter": money_fmt
, "cellStyle": {"textAlign": "right"}}
]
grid = AgGrid(
# Other setup
defaultColDef={
"cellStyle": {
"backgroundColor": "black",
"color": "white"}
})
$$
$$
cellClicked
property@callback(
Output("test_text", "children"),
Input("my_grid", "cellClicked")
)
def show_cell_info(cell_data):
return str(cell_data)
rowSelection
to "single"
or "multiple"
grid = AgGrid( # Other parts dashGridOptions={ "rowSelection": "single"} )
@callback( Output("test_text", "children"), Input("my_grid", "selectedRows") )
Building Dashboards with Dash and Plotly