Multiple filters in native (UI) filter

Is it possible to specify multiple filters? For example, I want to exclude all rows where the the column “TYPE” is equal to “ABC” and “DEF”. I can do one at a time with “!=ABC” and “!=DEF” but I’d like to do them at the same time.

Has this been implemented yet? If not, will this be implemented and when?

Hello @klamike could you please provide a little more context? If you have a pandas DataFrame you can filter it like with various methods, for example df.query("TYPE != 'ABC'").query("TYPE != 'DEF'") . If you would like do this kind of filters in a Dash datatable you can transform it to pandas for this.

It is possible to do this by wiring a separate component, like a dcc.Textarea, to the filter_query property of the datatable. The filter_query property allows much richer expressions including and operators.

I don’t have a complete example at the moment, but here’s a partial example from another project.

app.layout = ddk.App([

    dcc.Textarea(
        id='filter-input',
        style={'width': '100%', 'height': '200px'},
        value=textwrap.dedent(
        '''
        {id} > 100 and
        ({State} = TX or {State} = NJ) and
        {Date received} = {Date sent to company} and
        {Product} contains Debt and
        {Date received} datestartswith "2015-03"
        ''')
    ),

    ddk.Card(
        children=DataTable(
            id='demo-table',
            data=df.to_dict('rows'),
            columns=[{ 'id': i, 'name': i, 'type': types.get(i, 'any') } for i in df.columns],
            filter_action='native',
            page_action='none',
            virtualization=True,
            fixed_rows={'headers': True},
            style_data={
                'width': '200px'
            },
        )
    )
])

@app.callback(
    Output('demo-table', 'filter_query'),
    [Input('filter-input', 'value')])
def update_filter(value):
    value = value.strip()
    return value
three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online