I have a Categorical Heatmap (stand-alone, and closely based on the example in the Bokeh gallery), to which I have attached a CustomJS callback using a TapTool. The callback makes an Ajax call to a web service (with the factors from the selected cell of the Heatmap as parameters) and sets the innerHTML of a div based on the returned value. The div is created in a Jupyter notebook using a call to HTML(), or the same HTML is added manually to that produced by Bokeh via output_file(); either way, the update works as expected when a cell of the Heatmap is selected.
My problem is that I would like to clear the contents of the div when the selection is cleared (i.e. when the escape key is pressed). As I understand it, if I was using a Bokeh server, I could define a callback in Python and use “source.on_change(‘selected’, callback)” to update the plot itself (and/or linked plots and widgets) when the selection status changes. However, I don’t actually want to update the plot, only the div, and I can’t see how I can update the div using the Python callback approach.