Dash Table with row_selectable="multi" does not respond to data or columns callbacks
See original GitHub issueDataTable with row_selectable=“multi” does not respond to any columns or data callbacks.
Debug shows Javascript error:
TypeError: Cannot read property '0' of undefined
at e.getWeight (http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:18:65588)
at http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:18:98263
at http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:18:275516
at http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:12:10031
at Object.t [as a] (http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:1:1711)
at e.value (http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:18:98224)
at http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:18:96967
at e.memoizedCreateEdges (http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:1:2020)
at e.value (http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:18:99012)
at http://127.0.0.1:8050/_dash-component-suites/dash_table/bundle.js?v=3.7.0&m=1557928877:18:115236
Example:
import dash
import dash_table
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app = dash.Dash(__name__)
app.layout = html.Div(children=[
dash_table.DataTable(
id='table',
row_selectable="multi"
),
html.Div(id='dummy_input')
])
@app.callback(Output('table', 'columns'), [Input('dummy_input', 'children')])
def update_columns(dummy):
return [{"name": i, "id": i} for i in df.columns]
@app.callback(Output('table', 'data'), [Input('dummy_input', 'children')])
def update_data(dummy):
return df.to_dict('records')
if __name__ == '__main__':
app.run_server(debug=True)
Issue Analytics
- State:
- Created 4 years ago
- Comments:12
Top Results From Across the Web
No data returned for table and no callbacks triggered - Dash ...
I am trying to use selected_row_indices in a callback, following a bunch of examples from the forum. But clicking on the cells does...
Read more >Dash table updated in callback won't display - Stack Overflow
I want to have a second table with only the rows selected in first table. So, the data for the 2nd table are...
Read more >Creating Interactive Data Tables in Plotly Dash | by Akash Kaul
Without this, you can only access the row and column of the selected cell and not the actual value inside. Using this callback...
Read more >Sharing Data between Dash Callbacks - YouTube
Learn to use the Store component to share data between callbacks, tabs, and multiple pages. This will help your app from slowing down, ......
Read more >Building a Dashboard App using Plotly's Dash - Medium
For this, we will add tabs to our app layout and modify app.callback for graph so it returns chart for selected tab. we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rp2532 that is because you are returning empty lists when you don’t have uploaded data. Try this:
@montovaneli Confirming, that indeed works!