Python bokeh deselects the data table rows

Python bokeh deselects the data table rows … here is a solution to the problem.

Python bokeh deselects the data table rows

I would like to be able to “reset” data table.what should I do?

I defined an on_change('selected', my_callback) callback for my data table. The callback function has the following signature:

def my_callback(self, attr, old, new):
    ...

However, after calling the my_callback handler, I can’t deselect what I’ve selected.

I have tried manipulating the new[‘1d’] or old['1d'] dictionary without success.

What is the correct way to deselect rows in the datasheet and return to the original state where nothing was selected?

There is a similar question on G-groups, but no answer.
Thanks

Solution

To programmatically deselect a DataTable row and return to its original state with nothing selected, you can use it in python:

source.selected.indices = []

where source is the ColumnDataSource of the DataTable.

Related Problems and Solutions