holoviz / panel

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

Tabulator add support for column header tooltip #4138

Closed RaphaelRosset closed 1 month ago

RaphaelRosset commented 1 year ago

Tabulator javascript handle column header tooltips: https://tabulator.info/docs/5.4/menu#tooltips

Pass a dictionary {column: tooltip_string} as optional parameter to Tabulator constructor Update the javascript columns array accordingly.

User case: limited space to display table, so using short acronyms as column headers but would like to exposed full name in tooltips.

RaphaelRosset commented 1 year ago

I just realized that it is in fact already possible to setup a tooltip easily to any text displayed in the tabulator by passing an html string with a tooltip setup: "header/cell text" => "header/cell text"

dslemusp commented 1 year ago

Hi @RaphaelRosset, Could you elaborate a bit more on how to do this? (Perhaps with a bit of sample code). I am interested on doing this but cannot understand quite well what you mean.

Thx

RaphaelRosset commented 1 year ago

Hi @dslemusp, Yes my answer was indeed very unclear, below is an example where second column header is modified through html. The title keyword allows to pass a tooltip string

df = pd.DataFrame(
          {
              "int": [1, 2, 3],
              "<span style='background-color:beige;' title='Tooltip text'>header</span>": [
                  True,
                  False,
                  True,
              ],
          },
          index=[1, 2, 3],
      )
      tabulator = pn.widgets.Tabulator(df)
CTPassion commented 7 months ago

I second this as a requirement :)

hmijail commented 1 month ago

Thirded :)

ahuang11 commented 1 month ago

Would anyone be interested in contributing to implement this feature? I can provide guidance if needed.

Something around here: https://github.com/holoviz/panel/blob/main/panel/models/tabulator.ts#L721