The docs says:
The
Tabs
objects should never be modified directly. Instead, it is recommended to modify tabs using the provided methods, except when replacing the list ofobjects
entirely. Using the methods ensures that the rendered views of theTabs
are rerendered in response to the change, but even more importantly it ensures the tab titles are kept in sync with the objects.
but with the following code, the tab title does not update:
import panel as pn
import panel.widgets as pnw
def show_row1(event):
tabs.objects = [row1]
def show_row2(event):
tabs.objects = [row2]
row1 = pn.Row('This is row 1', name='row1')
row2 = pn.Row('This is row 2', name='row2')
tabs = pn.Tabs(row1)
button1 = pnw.Button(name='button1', on_click=show_row1)
button2 = pnw.Button(name='button2', on_click=show_row2)
pn.Column(pn.Row(button1, button2), tabs).servable()
The alternative I use in general is to .clear()
first and then repopulate but it seems to be slower.
Am I missing something or is it unexpected behavior?