@mukul.sharma wrote:
@app.callback( [Output(f"collapse-{i}", "is_open") for i in range(1, 4)]+[Output(f"collapse-card-{i}", "children") for i in range(1, 4)], [Input(f"group-{i}-toggle", "n_clicks") for i in range(1, 4)], [State(f"collapse-{i}", "is_open") for i in range(1, 4)]+[State(f"{i}", "children") for i in searchResults ] ) def toggle_accordion(n1, n2, n3, is_open1, is_open2, is_open3,graph_1,graph_2,graph_3): ctx = dash.callback_context # print({"id": c.component_id, "property": c.component_property} for c in [State('babylon-gender-pie', "children")] ) if not ctx.triggered: return "" else: button_id = ctx.triggered[0]["prop_id"].split(".")[0] if button_id == "group-1-toggle" and n1: return not is_open1, False, False,graph_1,None,None elif button_id == "group-2-toggle" and n2: return False, not is_open2, False,None,graph_2,None elif button_id == "group-3-toggle" and n3: return False, False, not is_open3,None,None,graph_3 return False, False, False,None,None,None
I want to use the updated searchResult list every time callback happens. searchResult is updated by other functions.
OR
How can I use State objects to get children elements outside the callback?
Posts: 2
Participants: 2