zhihanyue / qgridnext

Advancing QGrid, an interactive grid for exploring DataFrames in JupyterLab/Notebook
https://qgridnext.readthedocs.io
Apache License 2.0
24 stars 2 forks source link

javascript error on string column #12

Closed andrewkittredge closed 1 month ago

andrewkittredge commented 1 month ago

Environment

Windows Python 3.11.0

qgridnext==2.0.1 pandas==2.2.0 ipywidgets==8.1.5

    bqplot v0.5.31 enabled  X (python, bqplot)
    ipydatagrid v1.1.16 enabled  X
    jupyterlab-plotly v5.3.0 enabled  X
    jupyterlab_pygments v0.2.2 enabled  X (python, jupyterlab_pygments)
    mitosheet v0.1.424 enabled  X
    qgrid2 v1.1.3 enabled  X (python, qgrid2)
    @jupyter-widgets/jupyterlab-manager v3.0.1 enabled  X (python, jupyterlab_widgets)

Description of Issue

      [Open Browser Console for more detailed log - Double click to close this message]
      Failed to create view for 'QgridView' from module 'qgrid' with model 'QgridModel' from module 'qgrid'
      TypeError: Cannot read properties of undefined (reading 'enum')
          at m.initialize_slick_grid (http://localhost:8888/nbextensions/qgridnext/index.js?v=20241015130707:2:861180)
          at m.initialize_qgrid (http://localhost:8888/nbextensions/qgridnext/index.js?v=20241015130707:2:857601)
          at m.render (http://localhost:8888/nbextensions/qgridnext/index.js?v=20241015130707:2:857438)
          at http://localhost:8888/nbextensions/jupyter-js-widgets/extension.js?v=20241015130707:2:775052

Reproduction Steps

      import pandas as pd
      from qgridnext import show_grid
      show_grid(pd.DataFrame({"a": ["a", "b"]}).astype("string[python]"))

...

What steps have you taken to resolve this already?

The error occurs @ https://github.com/zhihanyue/qgridnext/blob/main/js/src/qgrid.widget.js#L275 because the cur_column.constraints is undefined.

zhihanyue commented 1 month ago

Thank you! I have fixed this error.