panel
panel copied to clipboard
Tabulator widget accessible from other tab in `pn.Tabs`
Reporting a nasty but also somewhat funny bug, in which I can sort of click on a Tabulator widget that is in a pn.Tabs layout while displaying another tab (not sure it's a Tabulator issue, a Tabs issue, or both).
import panel as pn
import pandas as pd
import numpy as np
pn.extension('tabulator', notifications=True)
df = pd.DataFrame(np.random.random((10, 10)))
table = pn.widgets.Tabulator(df)
table.on_click(lambda e: pn.state.notifications.error(f"Oops {e}"))
app = pn.Tabs(("Tabulator", table), ("Other", "Click below to trigger notifications from the Tabulator widget in the other tab!"))
app.servable()
It's not exclusive to Tabulator. It happens with links on Markdown panes, too, for example:
import panel as pn
md = pn.pane.Markdown("[LINK](https://www.example.com) " * 1000)
app = pn.Tabs(
("Markdown", md),
("Other", "Click below to trigger links of the other tab that is not active!")
)
app.servable()
As you might expect, the parameter dynamic=True on Tabs (basically lazy-loading) acts as a workaround. It's not pretty though as it re-renders the content effectively. But it's worth mentioning, I suppose.