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?
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?
I'll reiterate the comment that the table height is fixed and determined by table.height, so you can either dynamically update it as the other user suggested, or simply give it a "big enough" height to begin with.
However, I did want to point out something else. You should avoid creating new ColumnDataSource objets. Instead, best practice is much better to update the .data attribute of existing ones:
def update_data(attrname, old, new):
i = i_slider.value
table.source.data = get_square(i)
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?