DataTable clickable link?

Hi,

I am new to bokeh and have a question regarding the data table.I am displaying a Datatable and want the link (see below) to be clickable and open a new tab with the location of the html location.

test.PNG

I tried this:

columns = [

TableColumn(field=“Text”, title=“Text”, width = 200),

TableColumn(field=“Type”, title=“Type”, width = 200),

TableColumn(field=“File”, title=“File”, formatter = HTMLTemplateFormatter(template=’<%= value %>’), width = 600)

]

But doesn’t work. Anyone know how to fix this? Is it also possible to give the link a name. Like this:

Demo bokeh apps

Hi Zana,

Try something like this.

···

import pandas as pd

from bokeh.plotting import ColumnDataSource, curdoc

from bokeh.models.widgets import DataTable, TableColumn, HTMLTemplateFormatter

from bokeh.layouts import widgetbox, row

data = pd.DataFrame.from_dict({‘Text’: [‘test1’, ‘test2’],

‘Type’: [‘test1’, ‘test2’],

‘File’: [‘http://demo.bokehplots.com/apps’,

'[http://demo.bokehplots.com/apps’]](http://demo.bokehplots.com/apps’])})

source = ColumnDataSource(data)

columns = [TableColumn(field=‘Text’, title=‘Text’, width=200),

TableColumn(field=‘Type’, title=‘Type’, width=200),

TableColumn(field=‘File’,

title=‘File’,

formatter=HTMLTemplateFormatter(template=’<a href="<%= value %>“target=”_blank"><%= value %>’),

width=600)]

t = DataTable(columns=columns,

width=400,

height=400,

source=source)

curdoc().add_root(widgetbox(t))

On Fri, Aug 31, 2018 at 9:21 AM Zana [email protected] wrote:

Hi,

I am new to bokeh and have a question regarding the data table.I am displaying a Datatable and want the link (see below) to be clickable and open a new tab with the location of the html location.

test.PNG

I tried this:

columns = [

TableColumn(field=“Text”, title=“Text”, width = 200),

TableColumn(field=“Type”, title=“Type”, width = 200),

TableColumn(field=“File”, title=“File”, formatter = HTMLTemplateFormatter(template=’<%= value %>’), width = 600)

]

But doesn’t work. Anyone know how to fix this? Is it also possible to give the link a name. Like this:

Demo bokeh apps

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/31cf545b-635d-4946-9e17-db8d4fa7b38e%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Chase, that worked!