MRocklin MRocklin - 1 year ago 520
Python Question

Trigger event when Bokeh DataTable Selection

Is it possible to trigger a callback event when I select a row (or rows) of a Bokeh


def update(rows):

dt = DataTable(...)

I see that there is an
method that can trigger on a particular property, however I can not find a property that corresponds to the selected rows.

Answer Source

I believe that selecting a row of a data table is the same as making a selection a data source. So, if you attach a callback to the datasource powering the table then the callback should work.

source = ColumnDataSource(mpg)
columns = [....]
data_table = DataTable(source=source, columns=columns)
source.on_change('selected', callback)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download