☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

BokehJS: Callback on selected changed

Community Supportbokehjs
ghalter
ghalter

Hi all,

I’m currently looking into BokehJS and simply cannot find out, how to bind a callback to a selection
event. In python one could do something like that:

source.selected.js_on_change('indices', CustomJS(args=dict(source=source), code="""
        console.log("Hello selection!")
    """)
)

This doesn’t seem to work in BokehJS, because js_on_change is undefined.
So my questions are the following:

  • What’s the intended way of doing this in BokehJS?
  • Is there the possibility to bind javascript functions directly to a callback instead of using a CustomJS?

Thanks in advance!

Cheers,
Gaudenz

And here my script:

⌁   Link to post
ghalter
ghalter

Perfect, thanks a lot!

I added the updated code to the gist if anybody is interested:

⌁   Link to post

End of archived discussion · Replies are disabled