Hi
I’m using a Dropdown box with multiple set to true, call this the tickers_dropdown. This is feeding from a large number of “tickers”, which are made up of multiple parts.
I have implemented a number of other dropdown boxes to assist building these multiple part tickers and on a button click this passes the id up in to the dropdown box, but I want to append the new value to the tickers already selected.
As the main Ticker_Dropdown is creating the graphs.
My issue is that on button click I can’t append to the list of the tickers_dropdown, so I was storing everything to a hidden div. So all I’m getting with this is one selection and it will never overwrite to get 2. The list.append seems to be my problem, or how to update the tickers_dropdown to add from a function and not overwrite.
@app.callback(
Output(component_id='tickers_dropdown',component_property='value'),
[Input('button', 'n_clicks')],
state = [State(component_id='1_drop', component_property='value'),
State(component_id='2_drop', component_property='value'),
State(component_id='3_drop',component_property='value'),
State(component_id='4_drop',component_property='value'),
State(component_id='5_drop',component_property='value'),
State(component_id=6_drop',component_property='value'),
State(component_id='my-div',component_property='children')]
)
def update_ticker_dropdown(n_clicks, 1, 2, 3, 4, 5, 6, tickers_list):
tickers_filtered = """pandas filter the dataframe that is in the tickers_dropdown by all the 1 to 6 Drop componenets""""
if tickers_list is None:
return tickers_filtered.index
else:
return tickers_list.append(tickers_filtered.index)