☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Unselect all rows on a DataTable

Community Support
p-himik
p-himik

Manually you can just do what you do to select/unselect multiple rows. On Windows and Linux it’s usually done by holding Ctrl while clicking. So if a rows is selected, just Ctrl+click on it.
Alternatively, just construct DataTable with selectable='checkbox', and then each row would have a checkbox that you can easily unselect.

How to do it with a button:

from bokeh.io import curdoc
from bokeh.layouts import column
from bokeh.models import DataTable, TableColumn, ColumnDataSource, CustomJS, Button

cds = ColumnDataSource(dict(value=[1, 2, 3]))
dt = DataTable(columns=[TableColumn(field='value')], source=cds)

b = Button(label='Clear selection')
b.js_on_click(CustomJS(args=dict(cds=cds), code="cds.selected.indices = [];"))

curdoc().add_root(column(b, dt))
⌁   Link to post
Zana
Zana

Just a follow up question, how can you select all rows with a button (or if possible also manually)? It doesnt work pressing CTRL + A in the table to select all points.

⌁   Link to post
Zana
Zana

Is it possible manually?

from bokeh.io import curdoc
from bokeh.layouts import column
from bokeh.models import DataTable, TableColumn, ColumnDataSource, CustomJS, Button

cds = ColumnDataSource(dict(value=[1, 2, 3]))
dt = DataTable(columns=[TableColumn(field='value')], source=cds)

b = Button(label='Select All')
b.js_on_click(CustomJS(args=dict(cds=cds), code="""
cds.selected.indices = [...Array(cds.attributes.data.value.length).keys()];
"""))

show(column(b, dt))
⌁   Link to post

End of archived discussion · Replies are disabled