Issue with JS callback when selecting a bokeh datatable row

Viewed 169

I used a bokeh datatable in a simple report I had, which had the lines of:

source = ColumnDataSource(df)
callback = CustomJS(args=dict(callback_args), code="""some JS code""")
source.callback = callback

I had a simple JS code that would change some other datasources. Clicking on each row of the datatable would trigger it and it worked fine.

I upgraded bokeh to version 2.2.1

And now this code doesn't work anymore.

It seemed that for a datatable I might need to use something like:

source.js_on_change('value', callback)

or maybe:

source.js_on_change('start', callback)

But it doesn't work and the error I get is:

Uncaught (in promise) TypeError: Cannot read property 'connect' of undefined
at f.connect
at f._update_property_callbacks 
at f.connect_signals 
at Function._initialize_references_json 

I wonder if I am doing something wrong or is it possible that it's a bug in bokeh?

2 Answers

Not a bug. ColumnDataSource has neither a start property nor a value property. You can only add callback handlers for properties that exist. You probably want

source.selected.js_on_change('indices', ...)
Related