plotly / dash-table

OBSOLETE: now part of https://github.com/plotly/dash
https://dash.plotly.com
MIT License
419 stars 74 forks source link

Display a dropdown in the filter UI for categorical filtering #828

Open slum44 opened 3 years ago

slum44 commented 3 years ago

Hi,

I'm new to plotly dash and I've googled but I don't see a way to make a filter a dropdown akin to excel filters.

I've seen people do "hacks" but this should be the default behaviour out of the box (or at least a setting).

I'm currently evaluating plotly dash vs tools such as metabase and metabase has this out of the box.

From a UX pov, filters with a dropdown is a huge win and important for users. when looking at a new dataset, the filters hint + tell the user what values are in the column. Freeform text doesn't tell this story to the user.

chriddyp commented 3 years ago

Thanks for opening @slum44 ! Indeed this isn't built-in to the table right now but it's a great idea. Similarly a date picker for filtering dates or even sliders for filtering numbers (displaying the ranges)

We would keep the freeform text box as the default while we're in the 1.x.y series. Freeform text enables searching with the contains operator as well as filtering data in a custom python callback where the DataTable wouldn't know the unique values upfront (e.g. http://dash.plotly.com/datatable/callbacks)

For now, you'll need to wire your own dropdown(s) to the table. Custom Python-based filtering is documented here: http://dash.plotly.com/datatable/callbacks. Alternatively, we'd accept a pull request for this feature and would help out with mentoring.

dzieciou commented 2 years ago

I'm pasting my identical question from StackOverlfow: it constains screenshots from other UIs (Excel, DataTables.net) what this functionality looks like: https://stackoverflow.com/questions/69723198/dash-datatable-drop-down-filter

jcollins-bioinfo commented 1 year ago

I had provided an answer originally to @dzieciou 's StackOverflow question (which they share above), and have just added an update to it leveraging the ability in Dash 2+ to explicitly use dropdowns in cells of dash.dash_table.DataTables. The only thing that doesn't seem possible, which is in, say, Excel, is the ability to set multi=True for the dropdowns within cells. dash-datatable-drop-down-filter

@chriddyp If still a possibility (and also possible/practical from a software design perspective - not sure if there may have been some specific reason why the multi option was explicitly not included), I would be interested in contributing a pull request 🙂