holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.79k stars 519 forks source link

Multiselect-dropdown-checkbox widget #3018

Open maximlt opened 2 years ago

maximlt commented 2 years ago

Asking for a new widget that doesn't seem to exist in Bokeh right now and that I've seen in use in Tablea. It's a dropdown menu that allows to select multiple options by clicking on them (so the dropdown stays open after a click). Each option is prepended by a checkbox, that is ticked for the selected options. Most importantly the widget list has at the top of the options a Select All option that will select all the options when selected, or deselect them all. When the dropdown is closed the widget shows the selected option if there's only one. If all the options are selected it could display (All selected) or some other visual hint. If multiple but not all the options are selected, it could display either their count (e.g. (2)) or another visual hint (e.g. (Multiple selected)).

Here's an example: image

It's taken from the bootstrap-multiselect library (scroll down to the includeSelectAllOption option).

Note it's very similar to the default multiselect widget of Excel, so people are very used to it: image

MarcSkovMadsen commented 2 years ago

There is an example from syncfusion here https://ej2.syncfusion.com/demos/?_ga=2.130724431.1199674951.1639591753-833289642.1639591753#/material/multi-select/checkbox.html.

MarcSkovMadsen commented 2 years ago

There is a plain html+css+javascript example here https://stackoverflow.com/questions/17714705/how-to-use-checkbox-inside-select-option