hello everyone. I have list of links inside the table. each link is supposed to have its own id. depending on which link is clicked I want to call a function to draw a figure inside a modal. function takes a string as an argument for figure type. how can I achieve it so that the function inside the modal is called with hyperlink id as an argument? now I have only one callback for show/hide modal.
html.Td(html.A("title", id="some-id"))
dbc.Modal([
dbc.ModalBody(html.Div([
dcc.Graph(id="some-id", figure=foo("some-id"), responsive=False,
),])
], style={
"display": "flex", "flex-direction": "row", "margin": "45px",
'width': '90%',
'justify-content': 'center'
})),
dbc.ModalFooter(
dbc.Button(
"Close", id="close-modal-1",
)
),
],
id="modal-1",
size="lg",
className='modal'
),
@app.callback(
Output("modal-1", "is_open"),
[Input("some-id", "n_clicks"), Input("close-modal-1", "n_clicks")],
[State("modal-1", "is_open")],
)
def toggle_modal(n1, n2, is_open):
if n1 or n2:
return not is_open
return is_open