I have a relatively simple dashtable that fails to load when I use debug option in running the server.
Literally I can can change the server launch from:
app.run_server(host=“0.0.0.0”)
to
app.run_server(host=“0.0.0.0”,debug=True)
And I start seeing “Invalid argument columns[0].id
passed into DataTable”
The table without debug renders fine.
I’ve removed most of the dynamic data fetches and made it into a small static table and it shows the problem.
Any clues? what else should I be setting or doing for Debug mode?
import re
from datetime import datetime as dt
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table
from dash.dependencies import Input, Output
app = dash.Dash(__name__)
app.layout = html.Div(
children=[
html.H1('Violation Viewer'),
dcc.DatePickerSingle(
id='my-date-picker-single',
min_date_allowed=dt(2020, 4, 1),
date=str(dt.today())
),
html.Div(id='output-container-date-picker-single'),
html.Div(
style={"fond-family": "Arial"},
children=
[
dcc.Loading(id="tbl-load",
children=[
dash_table.DataTable(
id='violationtbl',
data=[],
sort_action='native',
# fixed_rows={'headers': True},
# style_table={'height': '500px', 'overflowY': 'auto'}
)
]
)
]
),
]
)
@app.callback(
[Output('output-container-date-picker-single', 'children'),
Output('violationtbl', 'data'), Output('violationtbl', 'columns')],
[Input('my-date-picker-single', 'date')])
def update_output(date):
string_prefix = 'You have selected: '
dateresponse = ""
if date is not None:
date = dt.strptime(re.split('T| ', date)[0], '%Y-%m-%d')
date_string = date.strftime('%B %d, %Y')
dateresponse = string_prefix + date_string
cols = [{"id": 0, 'name': "url"},
{"id": 1, "name": "analysis_test"},
{"id": 2, "name": "analysis_baseline"}]
data = [
['x', 'open', 'open'],
['y', 'test hello', 'closed'],
['z', 'open', 'http 200'],
['a', 'closed', '400'],
]
return dateresponse, data, cols
server = app.server
if __name__ == '__main__':
app.run_server(host="0.0.0.0")