This may be related to this existing issue and there is a very high likelihood that I am doing something stupid but here is what I am experiencing
I have a DataTable that when a user clicks a row a callback is issued where a new DataTable is created and added to the children of a row object. So that new DataTable is displayed below the first table which was clicked. The issue is that the row does not stay highlighted after being clicked. I checked the ‘selected’ property on the datasource and it still shows the row is selected. However clicking the same row will highlight that row. Also if instead I create a DataTable on the first click and then just update that datatable’s data source with each click then the highlighted row will work but only after the first click.
Here is some sample code to see what I am more or less seeing:
I am using Bokeh Server with bokeh 12.6.
Thanks!
from bokeh.models import ColumnDataSource
from bokeh.models.widgets import TableColumn, DataTable
from bokeh.layouts import row, column
from bokeh.plotting import curdoc
def populate_d2():
row_clicked = ds1.selected['1d']['indices'][0]
c1_val = ds1.data['c1'][row_clicked]
c2_val = ds1.data['c2'][row_clicked]
d2 = {'c3':list(range(0,c1_val + c2_val))}
dt2 = DataTable(source=ColumnDataSource(data=d2),
columns=[
TableColumn(field='c3', title='c3')
])
if len(d2_row.children) == 0:
d2_row.children.append(dt2)
else:
d2_row.children[0] = dt2
print(ds1.selected)
d1 = {‘c1’:list(range(0,10)), ‘c2’:list(range(0,20,2))}
ds1 = ColumnDataSource(data=d1)
dt1 = DataTable(source=ds1,
columns=[
TableColumn(field='c1', title='c1'),
TableColumn(field='c2', title='c2')
])
ds1.on_change(‘selected’, lambda attr, old, new: populate_d2())
d2_row = row()
curdoc().add_root(column(row(dt1), d2_row))