I have been searching for this without avail. I have a list of files I would like to choose from to change the data within a data table. I have a DropdownMenu that I would like to add the list of files to so that a user can select the file they want to view.
I thought getting the list and running a for loop I could create the DropdownMenuItems but that causes the site to display the message “Error loading layout”. Here is the piece of code I thought would work:
files = [f for f in listdir(pathway) if isfile(join(pathway, f))]
items = [{
dbc.DropdownMenuItem(i),
} for i in files]
dropdown = dbc.DropdownMenu(
direction="left",
children=[items],
label="Menu",
color="info",
),
app.layout =dbc.Container( [
html.Nav(navbar),
dbc.Row([
dbc.Col(dropdown,width=6, className="d-flex justify-content-end"),
],no_gutters=False, justify="between",),
...
Is there a different tactic to achieve this? I am sorry if this is a foolish question, I am quite new to python and Dash.