Catch CellClick event in Table

Hi!

My goal is to be able to find the cell coordinates clicked on a table (eg. “Row 5, column B was clicked”).

I saw in Tabulator’s documentation that it was possible to catch a “cell-click” event.

When I go into holoviz’ repo, I also see that the cell-click event is implemented.

Unfortunately, I’m quite new to Holoviz and after having tried everything I could think of, I still can’t make it work.

My code looks like this:

import panel as pn
import pandas as pd

pn.extension("tabulator")

selection = {"foo": "bar"}
def update_selection(event):
    selection = event

df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['a', 'b', 'c'])
tbl = pn.widgets.Tabulator(df)
tbl.param.watch(update_selection, 'cell-click')

pn.Column(selection, tbl)

If you have any idea of how to solve this, or documentation to explain me what I do wrong, it would be highly appreciated ! :slight_smile:

PS: Holoviz is a really great tool! Thanks you very much for building it!!

Have a great day

Hi @pholochtairze

Welcome to the community. I guess you are referring to the click functionality in http://tabulator.info/docs/5.1/callbacks#cell.

This is currently not supported. But please create a request on github. I believe this could be generally useful.

What is currently supported is row selection.

For example something like

import panel as pn
import pandas as pd

pn.extension("tabulator")



df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['a', 'b', 'c'])
tbl = pn.widgets.Tabulator(df, selectable=1)
 
def update_selection(event):
    return event

update_selection=pn.bind(update_selection, tbl.param.selection)

pn.Column(tbl, update_selection).servable()

image

Hi @Marc

Thank you very much for your very quick and precise answer!

I’ll open an issue on GitHub then!

Have a great day

1 Like