Skip to content

How to capture event on <Cmodal click Ok or cancel ? #92

Closed
@yaswanthkoneri

Description

@yaswanthkoneri
No description provided.

Activity

yaswanthkoneri

yaswanthkoneri commented on May 12, 2020

@yaswanthkoneri
Author

@woothu Documentation is not clear

woothu

woothu commented on May 12, 2020

@woothu

There is one event firing if the modal is closed "update:show". It doesn't specify how it was closed, so you need to create own 'footer' slot with buttons that have custom events.

bettafish15

bettafish15 commented on Jul 8, 2020

@bettafish15

then what is the point of the OK and Cancel button of the CModal? it doesnt make any sense. If it has buttons then it has to register events for them .

woothu

woothu commented on Jul 8, 2020

@woothu

@bettafish15 good point

reopened this on Jul 8, 2020
woothu

woothu commented on Jul 10, 2020

@woothu

In 3.1.1 version there is the third argument accept in the update:show event, it is true only if 'ok' button is clicked.

cocobienak

cocobienak commented on Oct 14, 2020

@cocobienak

how to use that,, can you give the example code.

bitbandit01

bitbandit01 commented on Dec 14, 2020

@bitbandit01

I see the fix but I still have no idea how to access the accept variable from the .sync event. Please update the documentation with an example or at least provide one here.

Editing my comment to provide an example that I figured out in case anyone else comes across this. Add an event listener to the Modal

<CModal title="Confirm Delete" color="danger" :show.sync="warningModal" @update:show="closeModal" > Are you sure you want to delete this variant? </CModal>

Then have a method called closeModal that takes 3 arguments:
closeModal(status, evt, accept) { if (accept) { //Ok was clicked so do whatever you want } }

geri777

geri777 commented on Nov 3, 2023

@geri777

For the OK button this is fine. But I also need to distinguish between the [Cancel] button and [X].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      How to capture event on <Cmodal click Ok or cancel ? · Issue #92 · coreui/coreui-vue