我一直在研究破折号应用程序,但遇到了一些麻烦。我的主要问题是布局-我正在尝试格式化一个下拉菜单,该菜单允许用户选择工作表,然后在页面上输出该工作表的内容。但是,我无法对其进行格式化以使其显示在第二页上。我只能在每个页面上显示它,或者根本不显示它。这是我目前用于布局的内容(即,我希望它显示在timelinesDates页面上)-
app.layout = html.Div([
dcc.Location(id='url', refresh=True),
html.Div(id='page-content',
children =[
html.H2("Select Target Company"),
html.Div([dcc.Dropdown(id="field_dropdown", options=[{
'label': i,
'value': i
} for i in dropdown_options],
value='Sheet3')],
style={'width': '25%',
'display': 'inline-block'}),
dt.DataTable(rows=[{}],
row_selectable=False,
sortable=False,
selected_row_indices=[],
id='datatable')
])
])
@app.callback(
dash.dependencies.Output('datatable', 'rows'),
[dash.dependencies.Input('field_dropdown', 'value')])
@app.callback(dash.dependencies.Output('page-content', 'children'),
[dash.dependencies.Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/' or pathname == '/overview':
return overview
elif pathname == '/timeline-dates':
return timelineDates,
def update_datatable(user_selection):
if user_selection == 'Sheet1':
return global_df_sheet_to_df_map.parse(0).to_dict('records')
elif user_selection == 'Sheet2':
return global_df_sheet_to_df_map.parse(1).to_dict('records')
else:
return global_df_sheet_to_df_map.parse(2).to_dict('records')
elif pathname == '/further-analysis':
return furtherAnalysis
elif pathname =='/excel-data':
return excelData
elif pathname == '/full-view':
return overview,timelineDates,furtherAnalysis, excelData
else:
return noPage