panel
panel copied to clipboard
Only part of the Tabulator widget displayed after an update
Triggering an update of a Tabulator table shrinks its display to 20 lines.
import numpy as np
import pandas as pd
import panel as pn
pn.extension('tabulator')
df = pd.DataFrame(np.random.rand(50, 3), columns=['a', 'b', 'c'])
table = pn.widgets.Tabulator(df)
bt = pn.widgets.Button(name='click')
def cb(e):
table.param.trigger('value')
bt.on_click(cb)
pn.Column(bt, table).servable()
This seems to work for me:
def cb(e):
try:
table._updating = True
table.param.trigger('value')
finally:
table._updating = False
I noticed that the disappearing only happened when I was zoomed in 100% if 90% or 110%, the rows would not disappear.
Ok strange as it seems then it's a UI problem more than a Python problem, if it only happens for different zoom levels.
I believe this is a Tabulator issue that was fixed in a recent release: https://github.com/olifolkerd/tabulator/issues/3380
The rows disappear when this line is executed, which happens all in Tabulator JS: https://github.com/holoviz/panel/blob/9cc50af8a3f3739e32b8952011eb5ab0df31e358/panel/models/tabulator.ts#L848
One possible workaround is to disable the virtual DOM rendering since this is what is causing the issue, with configuration={'virtualDom': False}
, however I don't know what other things this might break.
The real fix will be to update the Tabulator dependency to its latest version.