Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
chriddyp opened this issue Jul 23, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@chriddyp
Copy link
Member

commented Jul 23, 2018

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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.