Seems like a regression, please file an issue on GitHub with this information.
On May 2, 2018, at 14:10, [email protected] 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?
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, DataTable
source = ColumnDataSource(dict(x=list(range(10))))
source.js_on_change('selected', CustomJS(args=dict(source=source), code="source.change.emit()")) # doesn't help?
if not source.selected.indices:
new_index = 0
new_index = source.selected.indices+1
source.selected = Selection(indices=[new_index])
select.value = str(source.selected.indices)
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)
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")])
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 [email protected].
To post to this group, send email to [email protected].
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.