-
-
Notifications
You must be signed in to change notification settings - Fork 552
Description
Tested in OSX and Linux, Panel versions from 0.8.3 to 0.9.4 (and Bokeh 1.4.0 and 2.0.0, according to Panel requirements)
The issue
Hi! I am trying to embed a simple Panel layout (in this case in the notebook, but it could very well be with my_layout.save(embed=True)
that contains:
- 2 widgets (in this case
pn.widgets.Select
, but it doesn't matter) - 2 panes (in this case
pn.pane.Markdown
)
Where one pane is created through a reactive function involving one widget, and the other pane through another reactive function involving the other widget, as follows:
import panel as pn
pn.extension()
# First widget+pane:
widget_1 = pn.widgets.Select(options=["A", "B", "C"])
@pn.depends(widget_1.param.value)
def write_markdown_1(wid_val):
return pn.pane.Markdown(object="You selected %s!" % wid_val)
# Second widget+pane:
widget_2 = pn.widgets.Select(options=["D", "E", "F"])
@pn.depends(widget_2.param.value)
def write_markdown_2(wid_val):
return pn.pane.Markdown(object="You selected %s!" % wid_val)
Nothing special, it works as expected. However, I plan to generate a standalone HTML with these elements (no Bokeh Server, as my client does not know what is Python), so the easiest way would be to just wrap the elements inside a pn.Column
, embed the column and call it a day:
# Embed all in column, in order to show all elements:
column = pn.Column(widget_1, write_markdown_1, widget_2, write_markdown_2)
column.embed()
However, the embedding is not responding as it should be. For some reason, the first Markdown does not work; whereas the second one works perfectly. Please take a look at this video:
I believe there is some problem with pn.io.embed()
. I have tried to look at the code, but it has been really hard for me to figure out how the element tree is transversed in order to find what has to been transformed into a JsLink.
I mean, I believe it is a very first-world problem and not a whole lot of users will ever need to live without the Bokeh/Panel Server, but I have spent hours looking for the bug (the code above is just an example; the real code I'm writing is way more obfuscated).
If instead of placing everything in one Column we use two (one for each widget+pane), the problem disappears. However, exporting the whole thing as one HTML instead of two is way harder in that way (in fact, I have not been able to do so).
Thank you again for Panel. It's awesome.