Hi all,
I’ve been reading a lot of documentation and discussions about conditional formatting of datatable however I am able to solve my problem. I am trying to format negative cells in one column but is seems to ignore the filter_query condition and formats all cells in that row. Could anyone point out where is my mistake?
Thanks a lot
app = dash.Dash(name=__name__)
external_stylesheets = [
"https://getbootstrap.com/docs/4.2/dist/css/bootstrap.min.css"]
app = dash.Dash(__name__,
external_stylesheets=external_stylesheets)
app.config.suppress_callback_exceptions = True
app.layout = dash_table.DataTable(id='table-produto',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict('rows'),
style_cell={'padding': '5px'},
row_selectable='multi',
n_fixed_rows={'headers': True, 'data': 0},
sorting=True,
style_header={
'backgroundColor': 'white',
'fontWeight': 'bold'
},
style_data_conditional=[{
"if": {'column_id': 'Lucro Bruto',
'filter_query': '{Lucro Bruto} < 0'},
"backgroundColor": "#3D9970",
'color': 'white'
}]
)
if __name__ == '__main__':
app.run_server(debug=True)