Hi,
I am trying to update a table via a ColumnDataSource
The following code when run with bokeh serve illustrates the issue
from bokeh.layouts import widgetbox
from bokeh.models.sources import ColumnDataSource
from bokeh.models.widgets import DataTable, TableColumn
from bokeh.plotting import curdoc
from tornado import gen
from collections import deque
doc = curdoc()
s = ColumnDataSource(data=dict(thing=[‘sing’] * 5))
@gen.coroutine
def update():
d = s.data[‘thing’]
d.pop(0)
d.append(‘thong’)
s.data = {‘thing’: d}
columns = [
TableColumn(field=“thing”, title=“Thing”)
]
table = DataTable(
source=s, columns=columns, width=100, height=300,
row_headers=False
)
box = widgetbox(table, width=100)
doc.add_root(box)
doc.add_periodic_callback(update, 1000)
``
The table does not begin update until the header row is clicked on.
I also tried streaming.
from bokeh.layouts import widgetbox
from bokeh.models.sources import ColumnDataSource
from bokeh.models.widgets import DataTable, TableColumn
from bokeh.plotting import curdoc
from tornado import gen
doc = curdoc()
s = ColumnDataSource(data=dict(thing=[‘sing’] * 5))
@gen.coroutine
def update():
s.stream({‘thing’: [‘thong’]}, rollover=5)
columns = [
TableColumn(field=“thing”, title=“Thing”)
]
table = DataTable(
source=s, columns=columns, width=100, height=300,
row_headers=False
)
box = widgetbox(table, width=100)
doc.add_root(box)
doc.add_periodic_callback(update, 1000)
``
This generates an exception when the header row is clicked on.
ValueError: Must stream updates to all existing columns (missing: index)
Not sure if I am attempting something unsuported or doing something incorrect.
But the exception suggests there is a problem with the ColumnDataSource indexing.
baldrik