-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Labels
Description
When using a JavaScript function in getRowStyle, it will not be called, even though it is defined in an asset file.
Sample code:
app.py
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)
assets/functions.js
var dagfuncs = (window.dashAgGridFunctions = window.dashAgGridFunctions || {});
dagfuncs.rowStyleFunction = function (params) {
console.log("rowStyleFunction called");
return { backgroundColor: "blue", color: "white" };
};
Reactions are currently unavailable