This repository was archived by the owner on Aug 29, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 72
Filter does not support empty strings #569
Copy link
Copy link
Closed
Labels
Milestone
Description
Running the following code will fail with an AST error
import dash
from dash_table import DataTable
app = dash.Dash(__name__)
app.layout = DataTable(
id='table',
columns=[{
'name': x,
'id': x,
'selectable': True
} for x in ['a', 'b', 'c']],
data=[{
'a': str(x) if x % 2 == 0 else '',
'b': x if x % 3 == 1 else '',
'c': str(x*x) if x % 4 == 2 else ''
} for x in range(0,100)],
style_data_conditional=[{
'if': {
'column_id': x,
'filter_query': '{{{}}} eq ""'.format(x)
},
'backgroundColor': 'pink'
} for x in ['a', 'b', 'c']]
)
if __name__ == '__main__':
app.run_server(debug=True)
This is due to https://github.com/plotly/dash-table/blob/master/src/dash-table/syntax-tree/lexeme/expression.ts#L7 requiring at least one character inside the string. Removing this requirement will make the above code work as expected.