jupyter-widgets / ipydatagrid

Fast Datagrid widget for the Jupyter Notebook and JupyterLab
BSD 3-Clause "New" or "Revised" License
580 stars 51 forks source link

grid selection not working in jupyterlab4 #415

Closed jgunstone closed 1 year ago

jgunstone commented 1 year ago

Describe the bug following update to Jupyterlab==4 selection in datagrid not working

To Reproduce

from ipydatagrid import DataGrid
import pandas as pd
df = pd.DataFrame({"a": [1,2], "b": [3,4]})
DataGrid(df, layout=dict(height="100px"), column_widths={"a": 80}, selection_mode="row")
# clicking on a row doesn't select it

Expected behavior clicking a row will select that row

Screenshots

can't select row image

Environment (please complete the following information):

martinRenou commented 1 year ago

Thanks! Do you see an error in the JavaScript console?

jgunstone commented 1 year ago

using a fresh env

mamba create -n dg-jlab4 jupyterlab>=4 ipydatagrid pandas

image

image

image

image

martinRenou commented 1 year ago

So it looks like ipydatagrid uses this createCellConfigObject function that is private API from Lumino, this function may have been renamed or removed in Lumino 2, resulting in it not working for JupyterLab 4.

vthemelis commented 1 year ago

It looks like this function stopped being exported in https://github.com/jupyterlab/lumino/commit/f4feada592291af9e1e3e22313969cbcd724fffd

A bit of a shame that it was introduced in the first place as a private function . . .

martinRenou commented 1 year ago

Agreed, thanks a lot for pushing PRs for this!