panel icon indicating copy to clipboard operation
panel copied to clipboard

Panel Tabulator with Voila doesn't store user edits

Open obrown06 opened this issue 1 year ago • 6 comments

Example code:

import pandas as pd
import panel as pn
from bokeh.models.widgets.tables import NumberEditor
pn.extension('tabulator')
out = widgets.Output()
test_df = pd.DataFrame(columns=[
        "test_column_name",
    ])
test_df.loc[0] = [1]

test_df_widget = pn.widgets.Tabulator(test_df, editors={
    "test_column_name": NumberEditor(),
})

test_button = widgets.Button(
    description="Compare",
)

def test_on_click(b):
    curr_df = test_df_widget.value
    with out:
        display(curr_df.iloc[0]["test_column_name"])
test_button.on_click(test_on_click)

with out:
    display(test_df_widget, test_button)
out

Running this code in a voila app, we see a table displayed with a value of "1" in row 1, column "test_column_name".

image

When I edit the cell (e.g., to contain 432), we see the new value:

image

But when the button is pressed, the triggered callback still sees the original value:

image

Relevant versions:

panel                     1.4.1
voila                     0.5.6
ipywidgets                8.1.2
ipywidgets_bokeh          1.6.0
jupyter_bokeh             4.0.1

obrown06 avatar Apr 15 '24 14:04 obrown06

I can confirm the issue which has been also repoerted previuosly (see https://github.com/holoviz/panel/issues/3963) It has been reported also in the voila repositorysince I wasn't sure where theorign of the bug is coming from (whether Panel or Voila) ([https://github.com/voila-dashboards/voila/issues/1435)).

Kalandoros avatar Apr 20 '24 11:04 Kalandoros

Any thoughts here? Or suggested workarounds?

obrown06 avatar Apr 23 '24 22:04 obrown06

Could you try upgrading to jupyter_bokeh 4.0.4?

philippjfr avatar Apr 24 '24 06:04 philippjfr

I tested it with jupyter_bokeh 4.0.4 but the issue is still perisisting. It might be related to Failed to create module: package: @pyviz/jupyterlab_pyviz; module: ./extension: image reported in https://github.com/voila-dashboards/voila/issues/1435.

Kalandoros avatar Apr 24 '24 14:04 Kalandoros

Any additional suggestions @philippjfr ?

obrown06 avatar Apr 28 '24 03:04 obrown06

Should we assume this bug won't be addressed in the near term @philippjfr ?

obrown06 avatar May 02 '24 15:05 obrown06

Any signal here would be useful @philippjfr

obrown06 avatar May 15 '24 12:05 obrown06

Honestly, I don't know much about the internals of Voila, all I can say is that jupyter_bokeh works well in many other contexts (i.e. VSCode, Google Colab and in other Jupyter environments), so I'd consider this a Voila bug, not a Panel one.

philippjfr avatar May 15 '24 12:05 philippjfr

I'll close this as a duplicate of: https://github.com/holoviz/panel/issues/3963

philippjfr avatar May 15 '24 12:05 philippjfr