plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
20.84k stars 2.01k forks source link

[BUG] bool(DashTable) is always False #2906

Open JakkuSakura opened 3 days ago

JakkuSakura commented 3 days ago

Describe your context

dash                      2.17.1
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-table                5.0.0

Describe the bug bool(DashTable) is always False. I can't use tb or [] for shorthand when there is no data

from dash import dash_table
df = pd.DataFrame({'a': [1, 2]})
tb = dash_table.DataTable(df.to_dict('records'), columns=[{'name': column, 'id': column} for column in df.columns])
print(bool(tb))

Expected behavior

bool(tb) evaluates to True, either always or when there is data

Screenshots

image