Do you mean something like this (added table.height)?
from bokeh.io import curdoc, show
from bokeh.layouts import widgetbox
from bokeh.models import ColumnDataSource, Slider, DataTable, TableColumn
max_i = 200
init_i = 6
return dict(x = list(range(n)), y = [x ** 2 for x in range(n)])
source = ColumnDataSource(get_square(init_i))
columns = [TableColumn(field = “x”, title = “x”), TableColumn(field = “y”, title = “x**2”)]
table = DataTable(source = source, columns = columns, width = 320)
i_slider = Slider(start = 1, end = max_i, value = init_i, step = 1, title = “i”, width = 300)
def update_data(attrname, old, new):
i = i_slider.value
table.source = ColumnDataSource(get_square(i))
table.height = i * 25 + 25
layout = widgetbox(i_slider, table)
On Friday, November 2, 2018 at 10:49:07 PM UTC+1, Yizhou Zhu wrote:
Hi, I have question about update DataTables.
Attached is an example. (run by bokeh serve --show table_example.py)
The expected result is just a table of x vs x^2. x is controlled by the slider.
The table content is updated as expected. However, the number of rows is fixed to the initial value (6)
Ideally the table can change with the number of rows… Now it won’t show additional rows is x goes beyond the initial value.
Is there anyway I can get dynamic number of rows? Or at least, is there a way to fix the number of rows in the beginning?
Thank you !