[bokeh] 'callback not triggered when selected' issue with 0.13.0

Hi everyone,

I built a dashboard containing a datatable, two figures with cicrle glyphs (all with the same ‘source’ data source) and an extra figure made for plotting images. The logic is the following:

When a row from the datatable is selected or a glyph from either of the figures is selected, the corresponding index of the data source is retrieved, allowing to get the correpsonding path stored in the same data source in order to load the image in that extra plot.

With Bokeh 0.12.16,

the following code was working perfectly, allowing to select rows and glyphs alternatively in order to update the image:

···

def update_img():

try:

selected_index = source.selected[“1d”][“indices”][0]

new_path=source.data[‘Path’][selected_index]

url=’%s.png’ %new_path

img = plot.image_url(url=[url])

except IndexError:

pass

source.on_change(‘selected’, lambda attr, old, new: update_img())


When switching to Bokeh 0.13.0, I updated the code, based on that thread (https://github.com/bokeh/bokeh/issues/8014) as follows:


def update_img():

try:

selected_index = source.selected[“1d”][“indices”][0]

new_path=source.data[‘Path’][selected_index]

url=’%s.png’ %new_path

img = plot.image_url(url=[url])

except IndexError:

pass

source.selected.on_change(‘indices’,lambda attr, old, new: update_img())


With 0.13.0, source.selected ‘source.selected.on_change(‘indices’,callback)’ works fine, but only when selecting alternatively rows in the datatable.

When selecting glyphs from the figures, the callback is not triggered anymore (checked with a basic print) and also prevents the callback from working when selecting rows in the datatable afterwards.

There seems to be a link issue between the datable and the glyphs, but I’m really not sure of this…

Do you know what could be the reason and how this could be fixed ?

Don’t hesitate if you need more precisions,

Thanks for your help,

Jim

Probably this:

[https://github.com/bokeh/bokeh/issues/8021](https://github.com/bokeh/bokeh/issues/8021)

The switch to a proper Bokeh models for selections is a necessary move, but there have been some unanticipated regressions.

Thanks,

Bryan

···

On Jul 10, 2018, at 05:15, Jim Rhone [email protected] wrote:

Hi everyone,

I built a dashboard containing a datatable, two figures with cicrle glyphs (all with the same ‘source’ data source) and an extra figure made for plotting images. The logic is the following:

When a row from the datatable is selected or a glyph from either of the figures is selected, the corresponding index of the data source is retrieved, allowing to get the correpsonding path stored in the same data source in order to load the image in that extra plot.

With Bokeh 0.12.16,

the following code was working perfectly, allowing to select rows and glyphs alternatively in order to update the image:


def update_img():

try:

selected_index = source.selected[“1d”][“indices”][0]

new_path=source.data[‘Path’][selected_index]

url=’%s.png’ %new_path

img = plot.image_url(url=[url])

except IndexError:

pass

source.on_change(‘selected’, lambda attr, old, new: update_img())


When switching to Bokeh 0.13.0, I updated the code, based on that thread (https://github.com/bokeh/bokeh/issues/8014) as follows:


def update_img():

try:

selected_index = source.selected[“1d”][“indices”][0]

new_path=source.data[‘Path’][selected_index]

url=’%s.png’ %new_path

img = plot.image_url(url=[url])

except IndexError:

pass

source.selected.on_change(‘indices’,lambda attr, old, new: update_img())


With 0.13.0, source.selected ‘source.selected.on_change(‘indices’,callback)’ works fine, but only when selecting alternatively rows in the datatable.

When selecting glyphs from the figures, the callback is not triggered anymore (checked with a basic print) and also prevents the callback from working when selecting rows in the datatable afterwards.

There seems to be a link issue between the datable and the glyphs, but I’m really not sure of this…

Do you know what could be the reason and how this could be fixed ?

Don’t hesitate if you need more precisions,

Thanks for your help,

Jim

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/cc8dc7b4-763f-4a8d-bde8-4df3c45e71a4%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Looks like it is the same issue yes,

Thanks for the heads up,

Best,

Jim