Problem trying to highlight cells in dataTable

You’re super close! Just two things:

  • filter_query only applies to style_data_conditional, not style_cell_conditional (which also covers the headers)
  • It’s an array of objects, not just one object
    DataTable(
        data=data.to_dict('rows'),
        columns=[{'id': c, 'name': c} for c in data.columns],
        style_as_list_view=True,
        style_cell={'fontSize': 15},
        style_data_conditional=[{
            'if': {
                'column_id': 'param_2',
                'filter_query': '{param_2} eq 3'
            },
            'backgroundColor': 'rgb(255,0,0)'
        }],
    )

18%20PM

1 Like