This repository was archived by the owner on Jun 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Cannot dynamically create tables #28
Copy link
Copy link
Closed
Description
Hello,
Tables are great, they work fine when used in a layout directly, something like this is OK:
app.layout = html.Div([
html.Div(id='div1'),
html.Div(id='div2'),
html.Div(id='div3',children=[dt.DataTable(id='users table', rows=[{}], columns=['', 'col1', 'col2', 'col3', 'col4', 'col5'], filterable=True, sortable=True)])
])
But if you have a function create the table dynamically and assign it to the layout, tables do not even show up. This is needed for cases where you change the page content dynamically based on other inputs, for example If you decide whether to make a table or plot some figure based on a button, or if you want to have tables inside a tab body or so you'd have to do something like this:
app.layout = html.Div([
html.Div(id='div1'),
html.Div(id='div2'),
html.Div(id='div3')
])
@app.callback(Output(div3', 'children'),
[Input('dropdown1', 'value')])
def display_table(dropdown1_value):
return dt.DataTable(id='users table', rows=[{}], columns=['', 'col1', 'col2', 'col3', 'col4', 'col5'], filterable=True, sortable=True)
This doesn't work, The table doesn't show up at all, and no error messages are printed.
Metadata
Metadata
Assignees
Labels
No labels