Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Filter does not support empty strings #569

Description

@Marc-Andre-Rivet

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.

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions