Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] autosize_mode prevents DataTable values to be updated #13859

Open
Detectronic-AH opened this issue May 2, 2024 · 0 comments
Open

[BUG] autosize_mode prevents DataTable values to be updated #13859

Detectronic-AH opened this issue May 2, 2024 · 0 comments
Labels

Comments

@Detectronic-AH
Copy link

Software versions

Python version : 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0]
IPython version : 8.22.2
Tornado version : 6.4
Bokeh version : 3.4.1
BokehJS static path : /home/alexh/miniconda3/envs/vscode/lib/python3.12/site-packages/bokeh/server/static
node.js version : v21.7.2
npm version : 10.5.0
jupyter_bokeh version : (not installed)
Operating system : Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35

Browser name and version

No response

Jupyter notebook / Jupyter Lab version

No response

Expected behavior

When updating the values in the ColumnDataSource using a callback function, the updated values would be reflected in the DataTable.

Observed behavior

The blank table updates the first time the callback is run. Then after subsequent calls, the data fails to update.

Removing autosize_mode fixes this issue.

Example code

from bokeh.models import TableColumn, DataTable, ColumnDataSource
from bokeh.models.widgets import Button
from bokeh.io import curdoc
from bokeh.layouts import column

table_data = ColumnDataSource({"x": [], "y": []})

table_columns = [
    TableColumn(field="x", title="x")
]

b = Button(label="Update")

i = 1

def update_table():
    global i
    table_data.data = {
        "x": ["a" * i],
    }
    i += 1

b.on_click(update_table)

curdoc().add_root(
    column(
        b,
        DataTable(
            source=table_data, columns=table_columns, autosize_mode="fit_columns"
        ),
    )
)

Stack traceback or browser console output

No response

Screenshots

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant