You’ll need to configure the column with both a header_name and a field.
- The field should not include the space (e.g., “city_state”) and is what your JS will refer to and should be a column name n your dataframe.
- The header_name will be what is displayed (e.g., “city state”) in the table header
gob.configure_column(field="city_state", header_name="city, state")
jscode = JsCode("""
function(params) {
if (params.data.city_state === 'Corvallis, Oregon') {
return {
'color': 'black',
'backgroundColor': 'orange'
}
}
if (params.data.city_state === 'Eugene, Oregon') {
return {
'color': 'yellow',
'backgroundColor': 'green'
}
}
};
""")
I didn’t check the syntax, but you may get the gist of the solution.