You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
In DataTable's conditional formatting, we currently embed computed values into filter queries. For example, to highlight the maximum value of a column, we might write:
dash_table.DataTable(
style_data_conditional=[
{
'if': {
'column_id': 'Pressure',
# since using .format, escape { with {{'filter_query': '{{Pressure}} = {}'.format(df['Pressure'].max())
},
'backgroundColor': '#85144b',
'color': 'white'
},
]
)
While this works great most of the time, there are two shortcomings to this approach:
The syntax or computations can be tedious or difficult for certain computations, like highlighting the top 2 values in every row.
If the table is editable, then the computed values may not be accurate anymore. For example, if a user enters a value into the table that is greater than the current maximum.
#1 can be solved via documentation and #2 can be worked around by updating style_data_conditional via a callback when derived_virtual_data changes.
In the future, it may be nice to provide these filter expressions built-in to the table. We currently document workarounds for:
max, min, average (per column, per table, and per row)
top N and bottom N (per column, per table, and per row)
Above average or below average (per column, per table, and per row)
Heatmap gradients (per column, per table, and per row)
Top N% or bottom N% (per column, per table, and per row)
Activity