Move graph and table elements into callback function

master
Dan Howe 5 years ago
parent 857aea677b
commit 97f79bbab8

@ -41,7 +41,7 @@ app.layout = html.Div([
]) ])
def parse_contents(contents, filename, date): def parse_contents(contents, filename):
basename, ext = os.path.splitext(filename) basename, ext = os.path.splitext(filename)
content_type, content_string = contents.split(',') content_type, content_string = contents.split(',')
decoded = base64.b64decode(content_string) decoded = base64.b64decode(content_string)
@ -147,22 +147,23 @@ def parse_contents(contents, filename, date):
}, },
) )
elements = html.Div([ return graph_timeseries, graph_energy, table_energy
graph_timeseries, graph_energy, table_energy,
html.Div(id='datatable-row-ids-container')
])
return elements
@app.callback(Output('output-data-upload', 'children'), [ @app.callback(Output('output-data-upload', 'children'), [
Input('upload-data', 'contents'), Input('upload-data', 'contents'),
Input('upload-data', 'filename'), Input('upload-data', 'filename'),
Input('upload-data', 'last_modified'),
]) ])
def update_output(contents, name, date): def update_output(contents, name):
if contents is not None: if contents is not None:
return parse_contents(contents, name, date) graph_ts, graph_spec, table_spec = parse_contents(contents, name)
elements = html.Div([
graph_ts, graph_spec, table_spec,
html.Div(id='datatable-row-ids-container')
])
return elements
else: else:
return html.Div([]) return html.Div([])

Loading…
Cancel
Save