On change 'select' callback

I have been working with version 0.12.14 in the past using an on_change callback bound to the selected property of a column data source in a Bokeh server like the following:

Source.on_change ('selected', py_function)

This worked well for triggering row selection changes initiated from extended models using JavaScript/typescript by simply replacing the 'selected' dictionary with a new definition.

Sel = self.model.source.selected
Sel['1d']['indices'] = [selected_index]
self.model.source.selected = Sel

At this point, the py_function on the Bokeh server would execute and contain the updated source.selected property.

Since 0.12.15 I think the implementation of the 'selected' property for column data sources has changed. Now, the py_function no longer fires. I have tried variations of self.model.source.selected.change.emit() without success. My solution at the moment, since I am extending the Bokeh models, is to just add a new 'selected_row' property to this model and trigger on change events the same as before.

Is there a better way to accomplish this? If so,how can I properly achieve the same functionality of triggering the python function on the server from javascript in version 0.12.16?

-Andrew

Hi,

Can you provide a minimal complete example? You also mention data tables, and it should be mentioned there are some known regressions to data table 0.12.16 so we would need a complete example to run to determine where the actual problem lies.

Thanks,

Bryan

ยทยทยท

On Jun 5, 2018, at 10:53, [email protected] wrote:

I have been working with version 0.12.14 in the past using an on_change callback bound to the selected property of a column data source in a Bokeh server like the following:

Source.on_change ('selected', py_function)

This worked well for triggering row selection changes initiated from extended models using JavaScript/typescript by simply replacing the 'selected' dictionary with a new definition.

Sel = self.model.source.selected
Sel['1d']['indices'] = [selected_index]
self.model.source.selected = Sel

At this point, the py_function on the Bokeh server would execute and contain the updated source.selected property.

Since 0.12.15 I think the implementation of the 'selected' property for column data sources has changed. Now, the py_function no longer fires. I have tried variations of self.model.source.selected.change.emit() without success. My solution at the moment, since I am extending the Bokeh models, is to just add a new 'selected_row' property to this model and trigger on change events the same as before.

Is there a better way to accomplish this? If so,how can I properly achieve the same functionality of triggering the python function on the server from javascript in version 0.12.16?

-Andrew

--
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/47f5715b-d419-4505-9d36-32b0e8847510%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.