Callback untrigerred to update datatable yet clean code

hello guys , i hope y’all doing great . i’m building a dash app project . and i have this bug in the code , it’s metric web app that renders different pages, on the history page there is a datatable which is meant to be updates based on a particulat callback .i wrote a clean code but the callback is not trigerred when i change the date:

    elif pathname == "/page-2":
        layout = dbc.Container([
            html.H1("Trade Tracker App"),

            # Filtres pour choisir la date et les mois
                date=df['dates'].min(),  # Valeur par défaut : date minimale dans les données
                style={'margin-bottom': '20px'}
                    {'label': month, 'value': month} for month in df['dates'].dt.strftime('%B').unique()
                placeholder="Sélectionner un ou plusieurs mois...",
                style={'margin-bottom': '20px'}

                    {'name': col, 'id': col} for col in df.columns
                style_table={'overflowX': 'auto'},
                page_size=10,  # Définir le nombre de lignes par page
                style_cell={'textAlign': 'left'},

        # Callback pour mettre à jour le tableau en fonction des filtres
            Output('filtered-data-table', 'data'),
            [Input('date-picker', 'date'),
             Input('month-dropdown', 'value')]
        def update_filtered_data_table(selected_date, selected_months):
            print("callback trigerred")
            filtered_df = df.copy()

            if selected_date:
                filtered_df = filtered_df[filtered_df['dates'] == selected_date]

            updated_data = filtered_df.to_dict('records')

            return updated_data

        return layout

the data is displaying but the callback is ineffective

please help ME. thank you very much

Hi @likem and welcome to the Dash community :slightly_smiling_face:

It does not work to have a callback inside another callback. All the callbacks need to exist before the app starts. Only the layout needs to be returned.

It looks like you are making a multi-page app. Have you tried using Dash Pages?

hello @AnnMarieW thank you.

ohh okay, yes i’m building a multi page app with a side bar . Not yet i will try it out . being trying to solve that bug 2 weeks now. Thank you again