1

I am using Tabulator in Python to generate dynamic Quarto reports. I would like to embed a hyperlink in each cell to navigate to another page when clicked. I wasn't able to find how to do this from the documentation here: https://panel.holoviz.org/reference/widgets/Tabulator.html.

Vince
  • 3,325
  • 2
  • 23
  • 41

1 Answers1

0

Figured it out thanks largely to chatting with ChatGPT-4...

Need to use the bokeh.models.HTMLTemplateFormatter method:

from bokeh.models import ColumnDataSource, HTMLTemplateFormatter
link_formatter = HTMLTemplateFormatter(template="""<a href="<%= value %>" target="_blank"><%= value %></a>""")
pn.widgets.Tabulator(pd_df, formatters={"col1": link_formatter})

Where pd_df is a Pandas data frame and "col1" is the column with the value for the hyperlink.

Vince
  • 3,325
  • 2
  • 23
  • 41