with the little example below, i’d like to ask for the good practice to catch a change in cds in its attached callback.
Here patching (unless you hit the button very quickly) results in old and new dictionaries being the same.
So, how do we actually catch the changes ? (I naively expected this to be between old and new dictionaries)
Do we have to make some bookkeeping of the previous cds data so to be able to find the cds changes between the old and the new data ?
Hopefully there is a better way.
import numpy as np
from bokeh.io import curdoc
from bokeh.layouts import column
from bokeh.models import ColumnDataSource
from bokeh.models.widgets import DataTable, TableColumn, Button
source = ColumnDataSource(dict(index=[0,1,2], x=[0,0,0]))
print(‘source’,attr,old[‘x’],’ --> ',new[‘x’])
b = Button()
new = int(not source.data[‘x’])
data_table = DataTable(source=source, columns=[
TableColumn(field="x", title="x"), TableColumn(field="r", title="r"), ], editable=True)