plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
21.45k stars 2.07k forks source link

DataTable cannot programmatically clear filters #1973

Open jborman-exos opened 2 years ago

jborman-exos commented 2 years ago

Describe your context

dash                          2.3.0
dash-bootstrap-components     1.0.3
dash-core-components          2.0.0
dash-daq                      0.5.0
dash-html-components          2.0.0
dash-table                    5.0.0

Describe the bug

There is no way to programmatically clear a filter applied to a DataTable column via a callback. This has been documented by several other users in both the community forum and the old dash-table repo prior to the 2.0 release.

References:

According to the references above, the filter_query property only reacts to valid, non-empty strings like '{col_1} = abc'. Requiring a valid, non-empty string prevents resetting the filter_query to an empty state.

Expected behavior

There should be a way to clear this displayed filter text via a callback. Possibly through some new operator in the filter_query syntax like '{col_1}' EMPTY

Screenshots

See references above.

jborman-exos commented 2 years ago

A clean solution for the issue would be greatly appreciated. Some of the workarounds referenced in the links above indicate the user should update the filter to '{col_1} != <impossible-value>', but this is a messy solution that will confuse users.

I'd be happy to look into a solution with some direction/feedback from the core devs first.

mz09code commented 2 years ago

Hey, i had the same issues and i found this: https://github.com/plotly/dash-table/issues/370#issuecomment-1044635156. It works for me. Help it's helpful.