Black Lives Matter. Please consider donating to Black Girls Code today.

I push an option in dropdown and all callbacks activate

In mi code, when i push in dropdown with id which called ‘caracteristicas’, ‘update_sliders’ callback is activated. Why? WHat is wrong?

@app.callback(
    [Output('table','data'),
     Output('table','columns'),
    Output('table','page_count')],
    [Input('caracteristicas','value'),
     Input('table', "page_current"),
     Input('table', "page_size")])
def modify_table(carac,page_current,page_size):
    print("1")
    if carac:

        columns=[{"name": x, "id": x} for x in carac]
        df2 = data.loc[ : , carac]
        df2 = df2.iloc[page_current*page_size:(page_current+ 1)*page_size
        ].to_dict('records')
        lastCaracChoosen = carac.copy()
        return df2,columns,math.ceil(len(data_aux)/page_size)
    
    if carac == []:
        lastCaracChoosen = carac.copy()
    
    columns=[{"name": x, "id": x} for x in todosValores]
    df2 = data.iloc[page_current*page_size:(page_current+ 1)*page_size
    ].to_dict('records')
        
    return df2,columns,math.ceil(len(data_aux)/page_size)


@app.callback(
    Output('sepallengthsepallength','children'),
    [Input('filtrar','n_clicks')]
    )
def update_sliders(n_clicks,):
        print(n_clicks)
        if n_clicks:
            return u'sepallength ({} - {})'.format(n_clicks,n_clicks)
        

@app.callback(
    Output('slider-container','children'),
    [Input('caracteristicas','value')],
    [State('slider-container','children')])
def init_sliders(valores,existing_sliders):
    print("2")
    if existing_sliders:
        #Se ha quitado un valor
        difference = list(set(lastCaracChoosen) - set(valores))
        if difference:
            for i in difference:
                index = todosValores.index(i)
                existing_sliders[index]['props']['style']['display'] = "{}".format(None)
                ## Resetear rangeslider cuando se quita
                if (data[i].dtype == "int64" or data[i].dtype == "float64" and (len(data[i].unique())) > 10):
                    existing_sliders[index]['props']['children'][0]['props']['children'][1]['props']['value'] = \
                    [existing_sliders[index]['props']['children'][0]['props']['children'][1]['props']['min'],
                     existing_sliders[index]['props']['children'][0]['props']['children'][1]['props']['max']]
                else:
                    ## Resetear dropdown cuando se quita
                    existing_sliders[index]['props']['children'][0]['props']['children'][1]['props']['value'] = []

            return existing_sliders
        else:
            #Se ha sumado un valor
            difference = list(set(valores) - set(lastCaracChoosen))
            for i in difference:
                index = todosValores.index(i)
                existing_sliders[index]['props']['style']['display'] = "block"
            return existing_sliders
    else:
        for i in todosValores:
            if (data[i].dtype == "int64" or data[i].dtype == "float64" and (len(data[i].unique())) > 10):
                existing_sliders.append(html.Div([
                                            dbc.FormGroup( 
                                                [ 
                                                    #dbc.Label(children='{} ({} - {})'.format(i,min(data[i]),max(data[i])),id='{}{}'.format(i,i)),
                                                    html.Div(children='{} ({} - {})'.format(i,min(data[i]),max(data[i])),id='{}{}'.format(i,i)),
                                                    dcc.RangeSlider(
                                                        id='{}'.format(i), 
                                                        min=min(data[i]), 
                                                        max=max(data[i]),
                                                        step=round((max(data[i])-min(data[i]))/100,2),
                                                        value=[min(data[i]),max(data[i])],
                                                        #updatemode='drag',
                                                        allowCross=False,
                                                        marks={
                                                            min(data[i]): {'label': '{}'.format(min(data[i]))},
                                                            max(data[i]): {'label': '{}'.format(max(data[i]))}
                                                        },
                                                    )
                                                ]),
                                        ],className='col',style={'marginLeft': 0, 'marginRight': 0, 'marginTop': 0, 'marginBottom': 10, 
                                        'backgroundColor':'#F7FBFE',
                                        'border': 'thin lightgrey dashed',
                                        'border-radius': 10,
                                        'width':'auto',
                                        'display': '{}'.format(None),
                                        'padding': '6px 4px 4px 8px'}))
            else:
                existing_sliders.append(html.Div([
                                            dbc.FormGroup(
                                                [
                                                    #dbc.Label(children='{}'.format(i),id='{}{}'.format(i,i)),
                                                    html.Div(children='{}'.format(i),id='{}{}'.format(i,i)),
                                                    dcc.Dropdown(
                                                        id = '{}'.format(i),
                                                        options = [{
                                                             'label' : x, 
                                                             'value' : x
                                                        }for x in data[i].unique()],
                                                        multi = True,
                                                        placeholder=i
                                                     )
                                                ]) 
                                        ],className='col',style={'marginLeft': 0, 'marginRight': 0, 'marginTop': 0, 'marginBottom': 10, 
                                        'backgroundColor':'#F7FBFE',
                                        'border': 'thin lightgrey dashed',
                                        'border-radius': 10,
                                        'width':'auto',
                                        'display': '{}'.format(None),
                                        'padding': '6px 4px 4px 8px'}))
        return existing_sliders```

Hum, this should not happen. Are you 100% sure the callback is activated (for example, do you see the print statement of update_sliders every time you update caracteristicas ?)? Could you please upload a standalone script which we could run (including creating dummy data for your data variable) so that we can diagnose what’s going on?

This is my body:

body1 = dbc.Container(
    [
        dbc.Row(
            [
                dbc.Col(
                    [
                        html.H3("Elección de características"),
                        dbc.Row(
                            [
                                dbc.Col([
                                    dcc.Dropdown(
                                        id = 'caracteristicas',
                                        options = [{
                                             'label' : i, 
                                             'value' : i
                                        } for i in data.columns],
                                        multi = True,
                                        placeholder="Selecciona las características"
                                     ),
                                ],md=9),
                                dbc.Col([
                                    dbc.Button("Filtrar",id="filtrar", color="primary", className="ml-2"),
                                    
                                ],width="auto",md=3),
                            ],
                            className="mt-4",
                        ),
                        html.Br(),
                        html.Div(id='display-selected-values',children="No se han encontrado jugadores"),
                        html.Br(),
                        html.Div([
                        dash_table.DataTable(
                            id='table',
                            columns=[{"name": x, "id": x} for x in todosValores],
                            #data=data_aux.to_dict("rows"),
                            #filter_action="native",
                            #page_action="native",
                            data = data.iloc[0*15:(0+ 1)*15].to_dict('records'),
                            page_current= 0,
                            page_size= 15,
                            page_count= math.ceil(len(data)/15),
                            page_action='custom',
                            style_header=[
                                {
                                    'backgroundColor': 'rgb(230, 230, 230)',
                                    'fontWeight': 'bold'
                                }
                            ],
                            style_cell_conditional=[
                                {
                                    'minWidth': '0px', 'maxWidth': '180px',
                                    'textAlign': 'center'
                                }
                            ],
                            style_data_conditional=[
                                {
                                    'font_size': '14px',
                                    'if': {'row_index': 'odd'},
                                    'backgroundColor': 'rgb(248, 248, 248)'
                                    
                                }
                            ],
                            style_table={'overflowX': 'auto'}
                        )
                        ],id="divTable")
                    ],md=9
                ),
                dbc.Col(
                    [
                        html.H3("Filtros"),
                        html.Div([
                        dbc.Container(
                            id="slider-container",
                            children=[]
                        )],id="div-container",style={'overflowY': 'auto', 'height': 500}#,'backgroundcolor':'#7CD2E3','opacity':'0.5'}
                        )
                    ],md=3
                ),
            ]
        )
    ],
    className="mt-4",
)

Maybe because of I modify the children that contains the sliders?