
Hi,
Seems like a regression, please file an issue on GitHub with this information.
Thanks,
Bryan
···
On May 2, 2018, at 14:10, dan.cutright@gmail.com wrote:
Since the introduction of the Selection class, I've not been able to programmatically change which rows of a DataTable are highlighted as I used to be able to do by manually editing the source.selected object. I can verify source.selected is updated, but it doesn't appear to push a visual change anymore?
Am I missing something about how to use the Selection class?
Thanks,
Dan
from __future__ import print_function
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, Selection, Select, CustomJS
from bokeh.io import curdoc
from bokeh.models.widgets import Button, TableColumn, DataTablesource = ColumnDataSource(dict(x=list(range(10))))
source.js_on_change('selected', CustomJS(args=dict(source=source), code="source.change.emit()")) # doesn't help?def update_table_selection():
if not source.selected.indices:
new_index = 0
else:
new_index = source.selected.indices[0]+1source.selected = Selection(indices=[new_index])
select.value = str(source.selected.indices[0])def print_selection(attr, old, new):
print("old: %s" % old.indices)
print("new: %s" % new.indices)button = Button(label="Next", button_type="primary", width=200)
button.on_click(update_table_selection)
select = Select(value=' ', options=[" "]+[str(x) for x in range(10)], width=200, title='Selection Index')
table = DataTable(source=source, columns=[TableColumn(field="x", title="x")])
source.on_change('selected', print_selection)curdoc().add_root(column(button, select, table))
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/369f7733-4036-4e3e-a72d-da117c072d16%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
