What am I trying to do?
I am running a Bokeh server and embedding it currently with server_document()
in a flask environment of an external webpage. My Bokeh document contains two parts, let’s say a slider and a figure; I gave both a name and added them to the bokeh document with add_root()
.
Now I would like to put each of these roots into a separate div
when embedding, to allow the use of flexboxes to achieve a responsive design. Previously, I used Column()
or Row()
of Bokeh Layout, but Column()
looks bad on a landscape screen and Row()
looks bad on a mobile device.
What have I tried that did not work as expected?
In the reference documentation (section bokeh.embed) I found that if I use server_session()
over server_document()
, I can pass a model name to get individual document roots instead of the entire document. However, this does not work. I found this open github issue (Bring back the functionality needed to embed separate Bokeh roots within React · Issue #8499 · bokeh/bokeh · GitHub) that seems to be related but hasn’t seen any activity besides “is there a fix?” for about a year. After looking a bit into the source code (I am no expert by any means), it seems like the problem is the autoload_request_tag.html (bokeh.core.templates — Bokeh 2.4.2 Documentation), which does not make use of the modelid
that it receives.
Is there any update on this or a suggestion to achieve my goal in another way? I am restricted to using Bokeh Server (I need Python callbacks), so embedding with components()
is not an option; and because I don’t want Bokeh to serve all the content, I believe also the default Jinja2/directory template method does not work for me. I also cannot use multiple documents, because I want the two models to interact with each other, just like the Bokeh sliders example. I appreciate any advice!