Callback within a callback - Match

I cant get the second callback to be called, any ideas what I am missing?

# define callback
@app.callback(
    Output('xml-click-data', 'children'),
    Output('xml_tab', 'disabled'),
    Output('all_tabs', 'value'),

    [Input('table', 'active_cell'),
     Input("options", "value"),
     ],
    # (A) pass table as data input to get current value from active cell "coordinates"
    [State('table', 'data')]
)
def display_xml_data(active_cell, options,  data ):
    global index_file_dict
    div = html.Div([
        html.Div( '' , style={'color': 'blue', 'fontSize': 14})] )
    if active_cell is not None:
        row = active_cell['row']
        raw_file_name = index_file_dict[row]
        div = html.Div([
            html.Div(raw_file_name, style={'color': 'blue', 'fontSize': 14})])
        print(options ,  active_cell , raw_file_name)
        if 'Xml view' in options:
            global strat_xml
            strat_xml = get_xml_string_helper(raw_file_name)
            strat_xml_list = list(strat_xml.keys())
            key0 =  strat_xml_list[0]
            div =  html.Div([
                     dcc.Dropdown(strat_xml_list, key0 , id={'type': 'demo-dropdown',
                                                             'index':1,
                                                                }),
                     html.Div(strat_xml[key0], id= {'type': 'dd-output-container',
                                                             'index': 2,
                                                                })])


            return  div , False ,'xml_tab'




    return  div  , True , 'Main'



@app.callback(
    Output({"type": "xdd-output-container", "index": MATCH}  , 'children'),
    Input({"type": "demo-dropdown", "index": MATCH} , 'value')
)
def display_xml_data_drop_down(active_cell ):
    print(active_cell)
    global strat_xml
    return strat_xml[2]
1 Like

It’s hard to tell what’s going wrong without the full source code, so I can only guess.

The first thing I noticed is that you may have a typo: dd-output-container vs xdd-output-container. This could of course be intentional, but I can’t tell without the whole code.

Another thing to look into would be the Callback Gotchas:

Since your app involves dynamic modification of the layout (inserting a dropdown and output container into the layout), you have probably suppressed callback exceptions. This has the side effect that Dash does not notify you if some of your callback definitions are invalid.

Besides that, the index in ‘demo-dropdown’ and ‘dd-output-container’ don’t match…