You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation for DataTable currently alludes to the possibility of disabling the multi-select behavior. However there is no documentation that provides guidance on how to modify/control this behavior. DataTable makes use of SlickGrid to render, and the multi-select behavior is controlled by the option grid.getOptions().multiSelect.
The DataTableView is responsible for constructing/ownership of the grid. When the grid options are constructed no value is passed for multiSelect making it impossible to control this feature without possibly resorting to custom JS event hacks.
I'd like to propose adding the option multi_select: bool = True to the DataTable constructor so that we can pass this option through to the view, and then provide it when constructing the SlickGrid instance.
The text was updated successfully, but these errors were encountered:
@mstump that seems reasonable, given that you have some familiarity with things already, are you interested to work up a PR for this, with any help as necessary?
I've got some deadlines next week, but I'll submit a PR. In the meantime I've cooked up a hack/workaround using events.
importfunctoolsdeftable_select_callback(source, attrname, old, new):
# the lists of indicies are in random order, sort themnew=sorted(new)
old=sorted(old)
iflen(new) ==0:
# they selected 0 elements, returnreturneliflen(new) ==1:
# they selected 1 element, returnreturneliflen(old) ==0:
# this shouldn't be possible but it's JS. #YOLOsource.selected.indices= [new[0]]
source.selected.indices= [new[0]] ifold[0] !=new[0] else [new[-1]]
# table_source is your instance of ColumnDataSource or equivtable_source.selected.on_change(
"indices",
functools.partial(
table_select_callback, table_source
),
)
The documentation for
DataTable
currently alludes to the possibility of disabling the multi-select behavior. However there is no documentation that provides guidance on how to modify/control this behavior.DataTable
makes use ofSlickGrid
to render, and the multi-select behavior is controlled by the optiongrid.getOptions().multiSelect
.The
DataTableView
is responsible for constructing/ownership of the grid. When the grid options are constructed no value is passed formultiSelect
making it impossible to control this feature without possibly resorting to custom JS event hacks.I'd like to propose adding the option
multi_select: bool = True
to theDataTable
constructor so that we can pass this option through to the view, and then provide it when constructing theSlickGrid
instance.The text was updated successfully, but these errors were encountered: