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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

142584 Feb 11,2019 09:58 AM UTC Feb 13,2019 10:22 AM UTC JavaScript - EJ 2 3
loading
Tags: Dialog
Stefan
Asked On February 11, 2019 09:58 AM UTC

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(); };
}

Prince Oliver [Syncfusion]
Replied On 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 


Stefan
Replied On 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.

Prince Oliver [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;