Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

TypeError: Cannot read property '0' of undefined

$
0
0

I am rendering a datatable which is returned by a function call 'top_leads' that invokes a python script.

Here’s my code:

layout = html.Div([
    
    html.Div([

        dash_table.DataTable(
            id='tenant-table',
            page_size = 6,
            sort_action='native',
            row_selectable='multi',
            filter_action='native',
            row_deletable=True,
            editable=True
        ),
    ], style={'display': 'inline-block', 'width': '80%', 'float': 'left', 'margin-top': '14em'})
    
    
])



Callback: 


@app.callback([Output('tenant-table', 'data'),
               Output('tenant-table', 'columns')],
              [
                  Input("company-select", "value"),
                  Input("market-select", "value")
              ],
             )
def render_table(company, market):
    
    # Lookup Properties based on selections - Landlord and market. 
    
    result = top_leads(company, market) 
    
    columns = [{"name": i, "id": i} for i in result.columns]
    
    data = result.to_dict('records')
    
    return (data, columns)

This seems to be a JS/React.js error, however, I wanted to see if anyone has had to deal with this or have any workarounds.

Screenshot 2020-04-24 at 2.46.16 PM

8 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles