holoviz / panel

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

Split Tabulator.selectable into separate parameters per behaviour type #3140

Open grelston opened 2 years ago

grelston commented 2 years ago

Is your feature request related to a problem? Please describe.

I would like to select rows using checkboxes and set the maximum number of selectable rows to be 1. These are separate options of Tabulator.selectable and are therefore impossible to combine.

Describe the solution you'd like

Split the multiple behaviours controlled by the selectable parameter into separate parameters, e.g.:

I can't suggest where selectable='toggle' might belong because I haven't yet seen what it does. Does it make sense to be able to select both 'checkbox' and 'toggle' simultaneously? If so, it would need another different parameter name, e.g. selectable_toggle=True | False.

Describe alternatives you've considered

Initially I hoped that selectable='checkbox-single' would combine selectable='checkbox' and selectable=1, but the documentation states, "Same as ‘checkbox’ but header does not alllow select/deselect all".

Additional context

Background information is in my Tabulator UI selection problem Discourse post.

philippjfr commented 2 years ago

Thanks for writing this up. I'm fully in favor of this approach. The 'toggle' differs from the default behavior in that clicking selects and deselects a row, while the default behavior keeps the current row selected when you click multiple times. They are orthogonal options so I would just suggest that we have:

selectable_style='checkbox' | checkbox-no-header' | 'toggle' | 'default'