@krzyszsz wrote:
Hi Guys,
I am trying to build a Datatable with conditional formatting and highlighted row that is selected.
I have both elements but they can’t work together with my code
Callback changes my defined style_data_conditional which makes sense.
Maybe somebody has an idea how can I modify this callback (if condition) in a way that I get to keep my style_data_conditional part (I need to have negative values in certain columns highlighted with red font color) and still have selected row highlighted?style_data_conditional=[ {'if': {'column_id': 'Margin1', 'filter_query': '{Margin1} < 0'}, 'color': 'red'}, {'if': {'column_id': 'Margin2', 'filter_query': '{Margin2} < 0'}, 'color': 'red'}]@app.callback( Output('Mytable1', 'style_data_conditional'), [Input('Mytable1', 'selected_rows')] ) def update_styles(selected_rows): return [{ 'if': { 'row_index': i }, 'background_color': '#D2F3FF' } for i in selected_rows]
Posts: 1
Participants: 1






