voila-dashboards / voila

Voilà turns Jupyter notebooks into standalone web applications
https://voila.readthedocs.io
Other
5.32k stars 497 forks source link

Ipydatagrid callback on cell selection breaks on voila 0.5.0 #1384

Closed maltomato closed 10 months ago

maltomato commented 10 months ago

Description

I created a Jupyter Notebook where I trigger a function on selecting a cell in an Ipydatagrid. This works fine in JupyterLab. If I deploy the Notebook using voila 0.4.3 it still works fine. But when I update the voila Version to 0.5.0 the function is not triggered anymore.

Reproduce

import ipydatagrid
import pandas as pd
import ipywidgets as widgets

data = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])

grid = ipydatagrid.DataGrid(
    data,
    selection_mode="cell",
)

html = widgets.HTML()

def update_on_selection(grid):
    html.value = 'Update function reached!'

grid.observe(update_on_selection, names="selections")

widgets.VBox([
    html,
    grid,
])

Expected behavior

When selecting a cell in the Datagrid. The function should be reached.

Context

Command Line Output
On voila 0.5.0
[Voila] activity on 66f26fcb-f7ea-48ab-901c-bd58a4691ff5: status (busy)
[Voila] activity on 66f26fcb-f7ea-48ab-901c-bd58a4691ff5: status (idle)
On voila 0.4.3
[Voila] activity on 6e2953cc-89fc-4700-a6b8-6e697a477c3f: status (busy)
[Voila] activity on 6e2953cc-89fc-4700-a6b8-6e697a477c3f: status (idle)
[Voila] activity on 6e2953cc-89fc-4700-a6b8-6e697a477c3f: status (busy)
[Voila] activity on 6e2953cc-89fc-4700-a6b8-6e697a477c3f: comm_msg
[Voila] activity on 6e2953cc-89fc-4700-a6b8-6e697a477c3f: status (idle)
Browser Output
e.selections(...).iter is not a function
martinRenou commented 10 months ago

Thank you for opening an issue!

This issue is equivalent to https://github.com/bloomberg/ipydatagrid/issues/431, let's close it here and track the issue on the ipydatagrid repo.