✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

MATCH pattern not working as expected. Need help

I am using MATCH callback pattern for the following. In a tab I have a dropdown with list of dash tables displayed one below the other. So if user select one or more options from the dropdown, only those tables should be display and rest should be hidden. So i am using {‘display’: ‘none’} to hide the ones not in the dropdown selections. here is the callback below. It is working, but irrespective of how many selected only first one is displayed. Can someone point what mistake I am making here?

@app.callback(Output({'type': 'table-and-search-display-alltab', 'index': MATCH}, 'style'),
              [Input({'type': 'table-and-search-display-alltab', 'index': MATCH}, 'id'),
               Input('all-dataset-drop-down', 'value')
               ])
def show_specific_datasets(alltables, search_dsets_showlist):
    if search_dsets_showlist is not None and len(search_dsets_showlist) > 0:
        for srcdset in search_dsets_showlist:
            # Maching the selection value to the table index.
            if int(srcdset.split('_')[0]) == alltables['index']:
                return no_update
            else:
                return {'display': 'none'}

Hi there! Your use case is almost exactly what I am looking for.
Did you get it? I tried to match the graph’s id with a dropdown’s option, but there is no id for every dropdown’s option.
My idea is (step by step):

  1. The user adds a graph (and he can add as many as wanted)
  2. A new element is added to the dropdown’s options (so there is a match between this element and the added graph).
  3. The user can select this option.
  4. Given the selected option, he can modify the figure.

I am stuck trying to figure it out. Thank you for your help!