Datatable style_cell_conditional multiple column_id values for if

Hi, I have a quick question, how can I add more than one value for column_id within a if statement. For example, I like to style column 2, 6, and 7’s width; instead of writing 3 separate ifs with only the difference being the column_id, is it possible to do it within one if? Such as:

style_cell_conditional=[
                        {
                            'if': {'column_id': '2', '6', '7'},
                            'width': '60px'
                        }
                    ],

Hi,

Yes, it is possible. Just pass them as a list. :slight_smile:

From the documentation:

  • column_id , row_index , and header_index can be equal to a scalar (as above) or a list of values . For example, 'column_id': ['Region', 'Pressure'] is valid (new in Dash 1.12.0). DataTable filtering & conditional formatting performs faster when specified a list of values vs a list of separate if blocks.