holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.73k stars 516 forks source link

`Tabulator` `on_click` callback not firing in Jupyter notebook (using JupyterLab 3.3.1) #3692

Closed codingcyclist closed 2 years ago

codingcyclist commented 2 years ago

I'm trying to use the on_click callback on a Tabulator widget in the same way it is used in https://github.com/holoviz/panel/issues/3625. However, my callback function doesn't seem to be firing correctly. Note that I'm running my example from a jupyter notebook, instead of a panel server.

callback_error

ALL software version info:

python==3.7.10

Installed packages: (I'm working inside a Docker container -> no conda/virtualenv/pyenv) alembic==1.7.7 altair==4.2.0 anyio==3.6.1 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 async-generator==1.10 attrs==21.4.0 Babel==2.10.1 backcall==0.2.0 backports.zoneinfo==0.2.1 beautifulsoup4==4.11.1 bleach==5.0.0 blinker==1.4 bokeh==2.4.3 cachetools==5.1.0 certifi==2022.5.18.1 certipy==0.1.3 cffi==1.15.0 charset-normalizer==2.0.12 click==8.0.4 colorama==0.4.4 cryptography==37.0.2 cycler==0.11.0 db-dtypes==1.0.1 debugpy==1.6.0 decorator==5.1.1 defusedxml==0.7.1 entrypoints==0.4 fastjsonschema==2.15.3 fonttools==4.33.3 gitdb==4.0.9 GitPython==3.1.27 google-api-core==2.8.1 google-api-python-client==2.36.0 google-auth==2.6.6 google-auth-httplib2==0.1.0 google-auth-oauthlib==0.5.1 google-cloud-bigquery==3.1.0 google-cloud-bigquery-storage==2.13.1 google-cloud-core==2.3.0 google-cloud-storage==2.1.0 google-crc32c==1.3.0 google-resumable-media==2.3.3 googleapis-common-protos==1.56.2 greenlet==1.1.2 grpcio==1.46.3 grpcio-status==1.46.3 httplib2==0.20.4 idna==3.3 importlib-metadata==4.11.4 importlib-resources==5.7.1 ipykernel==6.13.0 ipython==7.33.0 ipython-genutils==0.2.0 ipywidgets==7.7.0 jedi==0.18.1 Jinja2==3.1.2 joblib==1.1.0 json5==0.9.8 jsonschema==4.5.1 jupyter-client==7.3.1 jupyter-core==4.10.0 jupyter-server==1.17.0 jupyter-server-mathjax==0.2.5 jupyter-telemetry==0.1.0 jupyterhub==2.2.1 jupyterlab==3.3.1 jupyterlab-git==0.34.2 jupyterlab-pygments==0.2.2 jupyterlab-server==2.14.0 jupyterlab-widgets==1.1.0 kiwisolver==1.4.2 loguru==0.6.0 Mako==1.2.0 Markdown==3.3.7 MarkupSafe==2.1.1 matplotlib==3.5.1 matplotlib-inline==0.1.3 mistune==0.8.4 nbclassic==0.3.7 nbclient==0.6.3 nbconvert==6.5.0 nbdime==3.1.1 nbformat==5.4.0 nest-asyncio==1.5.5 notebook==6.4.11 notebook-shim==0.1.0 numpy==1.21.5 oauthlib==3.2.0 packaging==21.3 pamela==1.0.0 pandas==1.3.5 pandas-gbq==0.17.0 pandocfilters==1.5.0 panel==0.13.1 param==1.12.2 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.1.1 prometheus-client==0.14.1 prompt-toolkit==3.0.29 proto-plus==1.20.5 protobuf==3.20.1 psutil==5.9.1 ptyprocess==0.7.0 pyarrow==6.0.1 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.21 pyct==0.4.8 pydantic==1.9.0 pydata-google-auth==1.4.0 pydeck==0.7.1 Pygments==2.12.0 Pympler==1.0.1 pyOpenSSL==22.0.0 pyparsing==3.0.9 pyrsistent==0.18.1 python-dateutil==2.8.2 python-dotenv==0.19.2 python-json-logger==2.0.2 pytz==2021.3 pytz-deprecation-shim==0.1.0.post0 pyviz-comms==2.2.0 PyYAML==6.0 pyzmq==23.0.0 qgrid==1.3.1 requests==2.27.1 requests-oauthlib==1.3.1 rsa==4.8 ruamel.yaml==0.17.21 ruamel.yaml.clib==0.2.6 scikit-learn==1.0.2 scipy==1.7.3 semver==2.13.0 Send2Trash==1.8.0 simplejson==3.17.6 six==1.16.0 smmap==5.0.0 sniffio==1.2.0 soupsieve==2.3.2.post1 SQLAlchemy==1.4.36 streamlit==1.8.1 streamlit-aggrid==0.2.3.post2 tabulate==0.8.9 terminado==0.15.0 threadpoolctl==3.1.0 tinycss2==1.1.1 toml==0.10.2 toolz==0.11.2 tornado==6.1 tqdm==4.63.0 traitlets==5.2.1.post0 typing-extensions==4.2.0 tzdata==2022.1 tzlocal==4.2 uritemplate==4.1.1 urllib3==1.26.9 validators==0.19.0 watchdog==2.1.8 wcwidth==0.2.5 webencodings==0.5.1 websocket-client==1.3.2 widgetsnbextension==3.6.0 zipp==3.8.0

Description of expected behavior and the observed behavior

The on_click callback function should log events in the right-hand pane, just as in https://github.com/holoviz/panel/issues/3625

Complete, minimal, self-contained example code that reproduces the issue

import pandas as pd
import panel as pn

pn.extension('tabulator')

df = pd._testing.makeMixedDataFrame()

receiver = pn.pane.Str('Click Event Log:\n\n', width=400)
t = pn.widgets.Tabulator(df, widths=100)
i = 0

def callback(e):
    global i
    receiver.object += f'Click Event #{i} {e.value}\n'
    i += 1

t.on_click(callback)
pn.Row(t, receiver)
maximlt commented 2 years ago

I cannot reproduce this issue. I'm a bit surprised by how the Tabulator widget looks in your GIF. Here's how it should look: image

Can you try refreshing your cache?

philippjfr commented 2 years ago

Closing for lack of response. Please reopen if this is still an issue and you can provide more detail.