We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ej.popups.DialogUtility.confirm: close property is ignored during configuration

When I configure a confirmation dialog, the close callback is ignored when configured during instantiation. It only works when setting close after the object is created:

Full StackBlitz sample

function addMeDialog(args) {
function dialogCancel() {
console.log("cancelled");
}

let d = ej.popups.DialogUtility.confirm({
/** shortened for illustration **/
cancelButton: { text: 'Cancel', click: function() {
dialogCancel();
this.hide();
} },
showCloseIcon: true,
closeOnEscape: true,
// this does not work
close: () => { console.log(args, 'closed from inside'); dialogCancel(); }
});
    // this does work, but it's ugly
d.close = () => { console.log(args, 'closed from outside'); dialogCancel(); };
}

3 Replies

PO Prince Oliver Syncfusion Team February 12, 2019 11:15 AM UTC

Hi Stefan, 

Thank you for contacting Syncfusion support.  

In the Dialog control, we have defined utility method to render a dialog using basic properties. The additional properties can be configured through its instance. The utility arguments are listed in the below link: https://ej2.syncfusion.com/documentation/dialog/how-to/render-a-dialog-using-utility-functions/ 

Kindly check the above shared documentation link and if you face any issue, kindly shared detailed information on the issue. This will help us provide a prompt solution at the earliest. 

Regards, 
Prince 



ST Stefan February 12, 2019 11:47 AM UTC

Thank you very much for the clarification.

It would be desirable to expose the close property in the DialogUtility methods in order to align the cancel action with the close actions (to ensure the cancel action is executed whether by clicking cancel, clicking the close icon or through closeOnEscape). I'll file this as a Feedback.


PO Prince Oliver Syncfusion Team February 13, 2019 10:22 AM UTC

Hi Stefan, 

Thanks for your update. 

Query 1: “It would be desirable to expose the close property in the DialogUtility methods in order to align the cancel action with the close actions (to ensure the cancel action is executed whether by clicking cancel, clicking the close icon or through closeOnEscape).” 

You can differentiate the close event based below conditions through the dialog utility instance, when clicking the close icon or press escape key or click the cancel button. Please find the below code. 

d.close = (args) => { 
    // Close the dialog using close icon 
    if (args.isInteraction && args.event.type == "click") { 
        alert("Close the dialog using close icon"); 
    } 
    // Close the dialog using escape key 
    if (args.isInteraction && args.event.type == "keydown") { 
        alert("Close the dialog using escape key"); 
    } 
    // Close the dialog using cancel button 
    if (!args.isInteraction && args.name == "close") { 
        alert("Close the dialog using cancel button"); 
    } 
} 
d.close = (args) => { 
    // Close the dialog using close icon 
    if (args.isInteraction && args.event.type == "click") { 
        alert("Close the dialog using close icon"); 
    } 
    // Close the dialog using escape key 
    if (args.isInteraction && args.event.type == "keydown") { 
        alert("Close the dialog using escape key"); 
    } 
    // Close the dialog using cancel button 
    if (!args.isInteraction && args.name == "close") { 
        alert("Close the dialog using cancel button"); 
    } 
} 

We have attached the sample for your reference, please find the sample for your reference: https://stackblitz.com/edit/jmwmds  

Query 2: “I'll file this as a Feedback.” 

Thanks for logging feedback portal. 

We will validate and consider your requirement. You can now track the current status of your request, and contact us for any further inquiries through this link: 

Regards, 
Prince 


Loader.
Up arrow icon