MRocklin MRocklin - 2 months ago 58x
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.


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)