
A bokeh server running a most simple app consisting of a single toggle button.
The label of the toggle button is updated on_click through binding either to a CustomJS callback or to a python function callback.
I expected the Toggle label to update when bound to the CustomJS callback after shutting down the server.
That is not the case. Seemingly because the callback is trying to sync the label on the python side.
Here is then a question on the principles (which may seem to go against the overall philosophy of bokeh):
in various circumstances the syncing with python side when using a bokeh widget is irrelevant as in this example
(here, the label is irrelevant, simply the state of the Toggle will be exploited later on)
How can this be implemented ? Is a custom extension of Toggle the way to go ?
(my secret goal is to speed up some interactions and remove some code on the python side when unnecessary)
Code:
toggle = Toggle(label=‘off’, active=False)
code=“”“if (cb_obj.label === “off”) {cb_obj.label =“on”;} else {cb_obj.label =“off”;}”“”
toggle.js_on_click(CustomJS(code=code))

