Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

ConfirmModel - submit_n_clicks_timestamp is fired when the cancel button is clicked #242

Closed
chriddyp opened this issue Jul 23, 2018 · 0 comments
Assignees
Labels
dash-type-bug Something isn't working as intended

Comments

@chriddyp
Copy link
Member

In this example, the callback is fired when the Cancel button is clicked. It should not be fired.

import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc

app = dash.Dash()

app.layout = html.Div([
    dcc.ConfirmDialogProvider(
        children=html.Button(
            'Click Me',
        ),
        id='danger-danger',
        message='Danger danger! Are you sure you want to continue?'
    ),
    html.Div(id='output')
])


@app.callback(Output('output', 'children'),
              [Input('danger-danger', 'submit_n_clicks_timestamp')])
def update_output(submit_n_clicks_timestamp):
    if not submit_n_clicks_timestamp:
        return ''
    return """
        It was dangerous but we did it!
        Submitted at {}
    """.format(submit_n_clicks_timestamp)


if __name__ == '__main__':
    app.run_server(debug=True)

cancel-button

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dash-type-bug Something isn't working as intended
Projects
None yet
Development

No branches or pull requests

2 participants