Based on the example here:
I’m trying to conditionally set the background of my rows based on a column value.
I wrote a loop like this to build the getRowStyle object:
getRowStyle = None
if conditionalRowColumnName is not None:
backgroundColors = [ '#EAF2F8', '#E8F8F5', '#FEF9E7', '#FDF2E9', '#F8F9F9', '#E9F7EF', '#F4F6F6', '#EAECEE']
# get unique values for column from table dfInput uniqueValues = dfInput[conditionalRowColumnName].unique() getRowStyle = { "styleConditions": [ ], "defaultStyle": {"backgroundColor": "grey", "color": "white"}, } counter = 0 for value in uniqueValues: getRowStyle['styleConditions'].append({ "condition": f"params.data.{conditionalRowColumnName} == '{value}'", "style": {"backgroundColor": f"{backgroundColors[counter]}"}, }) counter += 1
This worked for a while, and now this morning, I notice that it is no longer setting the background colors. The rows are always white.
I’m using dash-ag-grid 2.3.0
I’m wondering if something changed this week(?)