How to store data in from multiple callbacks

In my dash app, there is a data-table with data coming from different endpoints using rest API ( Endpoints are selected from a drop-down list) So whenever user selects a new endpoint, data gets stored in browser session using from a callback as below

@app.callback(Output('store-id', 'data'), Input('endpoint-name', 'value'))
def store_data(iData):
    return iData

My data-table is editable (with drop-down options) and I have a save button below the data table from where I want to save the modified data into the session store. But I cannot figure out a way how this second call_back will store/ replace data in same as Dash do not allow duplicate callback Output

@app.callback(Output('store-id', 'data'), 
        Input('endpoint-name', 'value'), 
        State('store-id', 'data'))
def store_data(iData, iData_):
    return iData_.append(iData)

and why have to use only one dcc.Store?

1 Like

My apologies, I did not mention my problem statement correctly, so I have 5 different tabs. On clicking on a specific tab, it parses data from a json file (which comes from the rest API I mentioned earlier) onto the data-table specific to that tab.
On each tab I can add new rows, delete or edit.
So under each tab I have a save button, once user clicks on save, the data should be stored in a
So that’s why I need to use same
Is there any other way to achieve this ? or may be use without a callback ? Thanks

from dash import Dash, html, Input, Output, callback_context

app = Dash(__name__)

app.layout = html.Div([
    html.Button('Button 1', id='btn-nclicks-1', n_clicks=0),
    html.Button('Button 2', id='btn-nclicks-2', n_clicks=0),
    html.Button('Button 3', id='btn-nclicks-3', n_clicks=0),

    Output('container-button-timestamp', 'children'),
    Input('btn-nclicks-1', 'n_clicks'),
    Input('btn-nclicks-2', 'n_clicks'),
    Input('btn-nclicks-3', 'n_clicks')
def displayClick(btn1, btn2, btn3):
    changed_id = [p['prop_id'] for p in callback_context.triggered][0]
    if 'btn-nclicks-1' in changed_id:
        msg = 'Button 1 was most recently clicked'
    elif 'btn-nclicks-2' in changed_id:
        msg = 'Button 2 was most recently clicked'
    elif 'btn-nclicks-3' in changed_id:
        msg = 'Button 3 was most recently clicked'
        msg = 'None of the buttons have been clicked yet'
    return html.Div(msg)

if __name__ == '__main__':

You can’t press these buttons at the same time, right?