Unexpected behavior when creating a dialog when another one is closed

Hi,

When i create a dialog using the AP.dialog module and on that dialogs on close event create a new one the second dialogs on close event is never called. Check the example below:

AP.dialog.create({
            key: "test-dialog",
            width: "40%",
            height: "20%",
            chrome: true,
        }).on("close", function (result) {
           AP.dialog.create({
            key: "test-dialog2",
            width: "40%",
            height: "20%",
            chrome: true,
        }).on("close", function (result) {
           console.log("Do Something")
        });
     });

On this case the “Do Something” is never displayed on the console.
Has anyone else experienced this or am i doing something wrong?

Hi there Andre,

I’m not sure exactly why the second close handler isn’t being called, however, you could use the following instead:

AP.events.on("dialog.close", function (result) {
    console.log("Do Something");
});

I’ve tested that with your example code and it works.

Regards,

Mike