Hello @kbally,
Yes, this is possible, but it requires redrawing the rows because you are adjusting the already rendered rows:
import dash_ag_grid as dag
from dash import Dash, html, Input, Output
import dash_bootstrap_components as dbc
app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
columnDefs = [
{"headerName": "Employee", "field": "employee", "checkboxSelection": True},
{"headerName": "Number Sick Days", "field": "sickDays"},
]
rowData = [
{"employee": "Josh Finch", "sickDays": 4},
{"employee": "Flavia Mccloskey", "sickDays": 1},
{"employee": "Marine Creason", "sickDays": 8},
{"employee": "Carey Livingstone", "sickDays": 2},
{"employee": "Brande Giorgi", "sickDays": 5},
{"employee": "Beatrice Kugler", "sickDays": 3},
{"employee": "Elvia Macko", "sickDays": 7},
{"employee": "Santiago Little", "sickDays": 1},
{"employee": "Mary Clifton", "sickDays": 2},
{"employee": "Norris Iniguez", "sickDays": 1},
{"employee": "Shellie Umland", "sickDays": 5},
{"employee": "Kristi Nawrocki", "sickDays": 2},
{"employee": "Elliot Malo", "sickDays": 3},
{"employee": "Paul Switzer", "sickDays": 11},
{"employee": "Lilly Boaz", "sickDays": 6},
{"employee": "Frank Kimura", "sickDays": 1},
{"employee": "Alena Wages", "sickDays": 5},
]
app.layout = html.Div(
[
dag.AgGrid(
id="grid",
columnDefs=columnDefs,
rowData=rowData,
dashGridOptions={'rowSelection': 'single', "getRowHeight": {"function": "params.node.isSelected() ? 50 : 20"}},
defaultColDef={'flex': '1', 'autoHeight': True},
getRowStyle = {
"styleConditions": [
{
"condition": "params.node.isSelected()",
"style": {'color': 'red'} # make other styling changes here, cannot be height
}
]
}
),
],
)
app.clientside_callback(
"""
function (s) {
dash_ag_grid.getApi('grid').redrawRows()
return window.dash_clientside.no_update
}
""",
Output('grid', 'id'),
Input('grid', 'selectedRows'),
prevent_initial_call=True
)
if __name__ == "__main__":
app.run(debug=True)