Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! ✅Check out the new docs.

Collecting n_clicks_timestamps

I have been playing around a lot, and haven’t found good solutions.
I need to to know what order buttons(or other components) was clicked.

I know there is Store, but it overwrites when a button is clicked twice.
Is there a good solution to know order (well timestamp can put it order nice), but:
button1>button2>button1>button1>button2 etc

Thank you

I think the code here may be helpful:

# Track button clicks
    output=Output(component_id='local_data', component_property='children'),
    inputs=[Input('button', 'n_clicks')],
    state=[State('local_data', 'children')],
    events=[Event('interval-sync-component', 'interval')]
def track_clicks(n_clicks, local_data_json):
    if n_clicks is None:
        n_clicks = 0

    local_data = json.loads(local_data_json)
    n_previous_clicks = local_data['n_clicks']

    # Update local data with the new click data
    local_data.update(**{'n_clicks': n_clicks, 'n_previous_clicks': n_previous_clicks})
    # local_data.update(**{'n_clicks': n_clicks, 'n_previous_clicks': n_previous_clicks})
    return json.dumps(local_data)

It’s not doing what you are asking but potentially you can store the timestamps with json.dumps(), and use json.loads() to read that in other functions.