Js_event_callbacks with customjs

Can I use js_event_callbacks with callback that is created by customjs ?


js_event_callbacks is not really intended for users to use directly. It is only a “public” property due to some other unrelated (and uninteresting) technical limitations. Please describe what it is you are actually trying to accomplish at a high level (i.e. without assuming any kind of implementation details) and then folks here can offer guidance.

Here is my related code that was working normally in Bokeh2.2

code = '  if ( (range_slider.value[0]==0.0) && (range_slider.value[1]==0.85) )
      { alert("Öncelikle Kaydırma Çubuğu ile Tehlike Aralığı Belirleyiniz !");
 } '

critical_selection.js_on_click(CustomJS(args={'chck_group': critical_selection,'range_slider':range_slider }, code=code))

bokeh3.2.1 complained as : ```
File “/app/main.py”, line 1316, in
critical_selection.js_on_click(CustomJS(args={‘chck_group’: critical_selection,‘range_slider’:range_slider }, code=code))
File “/usr/local/lib/python3.11/site-packages/bokeh/core/has_props.py”, line 360, in getattr
self._raise_attribute_error_with_matches(name, properties)
File “/usr/local/lib/python3.11/site-packages/bokeh/core/has_props.py”, line 368, in _raise_attribute_error_with_matches
raise AttributeError(f"unexpected attribute {name!r} to {self.class.name}, {text} attributes are {nice_join(matches)}")
AttributeError: unexpected attribute ‘js_on_click’ to CheckboxGroup, similar attributes are js_event_callbacks


@ahmettemiz88 in the future please use proper code formatting (either with the </> icon on the editing toolbar, or triple backtick ``` fences around the code blocks)

js_on_click was remove at Bokeh 3.0. There is not enough information above to provide any guidance (without guessing, which I am not going to do). What exact kind of widget is critical_selection and what kind of interaction are you trying to achieve (described from the user perspective)?

Otherwise all I can do is mention in general that the only two relevant APIs are now:

  • js_on_change for responding to property changes
  • js_on_event for responding to various UI events

There is much documentation and examples of both:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.