
Hello,
From reading the doc, my understanding was that the variable “cb_obj” could be always used inside a CustomJS to reference the model that triggered the callback.
However, this doesn’t seem the case when used on a button.js_on_click callback:
from bokeh.models import Button, CustomJS
from bokeh.plotting import output_notebook, show
b = Button(label="My button")
cb1 = CustomJS(args={'b': b}, code='console.log("cb1: " + b.label)')
cb2 = CustomJS(args={}, code='console.log("cb2: " + cb_obj.label)') # Gives "undefined"
cb3 = CustomJS(code='console.log("cb3: " + cb_obj.label)') # Gives "undefined"
b.js_on_click(cb1)
b.js_on_click(cb2)
b.js_on_click(cb3)
show(b)
Am I doing something wrong here, or the “js_on_click()” doesn’t support the use of “cb_obj”?
