panel icon indicating copy to clipboard operation
panel copied to clipboard

Split Tabulator.selectable into separate parameters per behaviour type

Open grelston opened this issue 3 years ago • 1 comments

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.:

  • selectable=True | False
  • selectable_style='checkbox' | checkbox-single'
  • selectable_max=int (or selectable_max_rows=int)

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.

grelston avatar Jan 24 '22 18:01 grelston

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'

philippjfr avatar Jan 24 '22 18:01 philippjfr