My app populates a dropdown from a database. The list of values changes very occasionally and I’d like to reload the values when the page is refreshed. I’m using a multi-page app but a simplistic example is
import dash
from dash import html, dcc
app = dash.Dash(__name__)
def get_items():
print('updating items')
return [{'label': 'foo', 'value': 'foo'}]
app.layout = html.Div(
children=[dcc.Dropdown(id='my-dropdown', options=get_items())]
)
if __name__ == '__main__':
app.run_server(debug=True)
The get_items
helper only gets called once, I’d like to somehow trigger on page reload - is there a callback I can use for this?