Black Lives Matter. Please consider donating to Black Girls Code today.

DataTable Callback with Tabs

Hi,

I am trying to display a table from the “dash_table_experiments”-pack. I have troubles displaying the table when I am using Tabs for switching pages.
I have no clue where the Problem is, but I think it could be this callback > @app.callback(Output(‘tab-output’, ‘children’)

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
import json
import pandas as pd
import numpy as np

app = dash.Dash()
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
app.config['suppress_callback_exceptions']=True


app.layout = html.Div([       
        html.Div(id='header' , style={'height': '100'}),       
        html.Div([        
            dcc.Tabs(
                    tabs=[
                            {'label': 'tab 1', 'value': 1},
                            {'label': 'tab 2', 'value': 2},
                            {'label': 'tab 3', 'value': 3},
                    ],    
                    value=1,
                    id='tabs',
                    vertical=True,
                    style={'height': '1000', 'width': '20%', 'float': 'left'}),                    
            html.Div(id='tab-output' , style={'height': '1000', 'width': '80%', 'float': 'left'})            
        ], id='content' , style={'height': '1000'})            
], style={'height': '1000', 'width': '100%'})


@app.callback(Output('table', 'row'), [Input('tabs', 'value')])
def clean_data():    
    DF_WALMART = pd.read_csv("C:/files/1962_2006_walmart_store_openings.csv")    
    return (DF_WALMART.to_dict('records'))


@app.callback(Output('tab-output', 'children'),
              [Input('tabs', 'value')])
def display_tab(value):

    if value == 1:
        return (
            html.Div(dt.DataTable(rows=[{}], id="table"), style={'display': 'none'})
        )

    
    if value == 2:
        return (html.Div())

    if value == 3:
        return (html.Div())




app.css.append_css({
    "external_url": "C:/files/bWLwgP.css"
})

if __name__ == '__main__':
    app.run_server(debug=True)

See Comment #40 - Display tables in Dash