Hello, I have a requirement to calculate a getRowStyle through a JS function, as I have tried here:
import dash_ag_grid as dag
from dash import Dash, html
app = Dash()
rowData = [
{"employee": "Josh Finch", "sickDays": 4},
{"employee": "Flavia Mccloskey", "sickDays": 1},
{"employee": "Marine Creason", "sickDays": 8},
]
columnDefs = [
{"headerName": "Employee", "field": "employee",},
{"headerName": "Number Sick Days", "field": "sickDays"},
]
getRowStyle = {
"function": "rowStyleFunction(params)",
}
app.layout = html.Div(
[
dag.AgGrid(
id="styling-rows-conditional-style2",
columnDefs=columnDefs,
rowData=rowData,
columnSize="sizeToFit",
getRowStyle=getRowStyle,
dashGridOptions={"animateRows": False},
),
],
)
if __name__ == "__main__":
app.run(debug=True)
where my assets/custom.js looks like this:
var dagfuncs = (window.dashAgGridFunctions = window.dashAgGridFunctions || {});
dagfuncs.rowStyleFunction = function (params) {
console.log("rowStyleFunction called");
return { backgroundColor: "blue", color: "white" };
};
Is this not possible? The function is not being called, even though when I do the exact same through cellStyle in the column defs, it works fine.
My dash-ag-grid version is 31.2.0, dash is 2.18.2, and python is 3.11.0