I think 0.13 lost functionality to programmatically use selection indices? In 0.12.16, the code below will update the drop_down when I click on a row of the data_table. In 0.13, it does not. Am I not fully compatible with the relatively new Selection() functionality or perhaps there’s a bug in >=0.13?
Thanks,
Dan
from bokeh.layouts import column
from bokeh.io import curdoc
from bokeh.models.widgets import Select, TableColumn, DataTable
from bokeh.models import ColumnDataSource
source = ColumnDataSource(data=dict(row=[‘1’, ‘2’, ‘3’]))
def update_drop_down_on_selection(attr, old, new):
if new.indices:
drop_down.value = drop_down.options[min(new.indices)]
drop_down = Select(value=‘1’, options=[‘1’, ‘2’, ‘3’], width=50, title=“Row”)
data_table = DataTable(source=source, columns=[TableColumn(field=“row”, title=“Row”, width=60)])
source.on_change(‘selected’, update_drop_down_on_selection)
layout_query = column(drop_down, data_table)
curdoc().add_root(layout_query)
Clarified here: ColumnDataSource callback on_change issue in 0.13 · Issue #8014 · bokeh/bokeh · GitHub
Should use source.on_change(‘indices’, myfunc) instead.
···
On Thursday, June 28, 2018 at 6:36:14 PM UTC-4, [email protected] wrote:
I think 0.13 lost functionality to programmatically use selection indices? In 0.12.16, the code below will update the drop_down when I click on a row of the data_table. In 0.13, it does not. Am I not fully compatible with the relatively new Selection() functionality or perhaps there’s a bug in >=0.13?
Thanks,
Dan
from bokeh.layouts import column
from bokeh.io import curdoc
from bokeh.models.widgets import Select, TableColumn, DataTable
from bokeh.models import ColumnDataSource
source = ColumnDataSource(data=dict(row=[‘1’, ‘2’, ‘3’]))
def update_drop_down_on_selection(attr, old, new):
if new.indices:
drop_down.value = drop_down.options[min(new.indices)]
drop_down = Select(value=‘1’, options=[‘1’, ‘2’, ‘3’], width=50, title=“Row”)
data_table = DataTable(source=source, columns=[TableColumn(field=“row”, title=“Row”, width=60)])
source.on_change(‘selected’, update_drop_down_on_selection)
layout_query = column(drop_down, data_table)
curdoc().add_root(layout_query)
correction: source.selected.on_change(‘indices’, myfunc)
···
On Thursday, July 5, 2018 at 9:19:15 AM UTC-4, [email protected] wrote:
Clarified here: https://github.com/bokeh/bokeh/issues/8014
Should use source.on_change(‘indices’, myfunc) instead.
On Thursday, June 28, 2018 at 6:36:14 PM UTC-4, [email protected] wrote:
I think 0.13 lost functionality to programmatically use selection indices? In 0.12.16, the code below will update the drop_down when I click on a row of the data_table. In 0.13, it does not. Am I not fully compatible with the relatively new Selection() functionality or perhaps there’s a bug in >=0.13?
Thanks,
Dan
from bokeh.layouts import column
from bokeh.io import curdoc
from bokeh.models.widgets import Select, TableColumn, DataTable
from bokeh.models import ColumnDataSource
source = ColumnDataSource(data=dict(row=[‘1’, ‘2’, ‘3’]))
def update_drop_down_on_selection(attr, old, new):
if new.indices:
drop_down.value = drop_down.options[min(new.indices)]
drop_down = Select(value=‘1’, options=[‘1’, ‘2’, ‘3’], width=50, title=“Row”)
data_table = DataTable(source=source, columns=[TableColumn(field=“row”, title=“Row”, width=60)])
source.on_change(‘selected’, update_drop_down_on_selection)
layout_query = column(drop_down, data_table)
curdoc().add_root(layout_query)