I have an application with a plot and DataTable. I used one of the examples using the BoxSelectTool to add rectangles to the plot. The dimensions of the rectangles are saved to a ColumnDataSource that is displayed in the DataTable. When the DataTable is modified I save those changes and redraw the boxes.
Currently, when I draw a box it gets added to the DataTable, but no sent back to python. When I edit an entry in the table then the current state gets sent back to python.
After reading some code and GH issues I found a work-around in my CustomJS callback for the BoxSelectTool:
selected_callback = CustomJS(args=dict(source=annotations, glyphs=glyph, table=annotation_table), code="""
var geometry = cb_data[‘geometry’];
// update data source with new Rect attributes
// < omitted .push to source >
// trigger update of data source
table.source.data = table.source.data
The work-around is the table.source.data = table.source.data which is required to trigger the “_tell_document_about_change” in the ColumnDataSource. Ideally I could just call that function after doing the push rather than doing a meaningless copy to trigger the notification.
Is that possible? I’m not good with js, but my tinkering hasn’t found that function exposed to me.