In the project, when the customer closes the pop-up window, if the red X or cancel button is clicked, the message "confirm to save the current operation" is displayed, otherwise, I won't be prompted to write this in the pop-up window.
The Code is as follows:
$ ('# A'). click (function () {// click the event
$ ('# W'). window ({// window Initialization
Title: 'random point', width: 400, height: 300, iconCls: 'icon _ add ',
// Important part
OnBeforeClose: function () {// event triggered before the panel is closed
If (confirm ('the window is closed. Make sure that your current operation is saved. Close the window? ')){
$ ('# W'). window ('close', true); // call the close method here. true indicates that the onBeforeClose callback function is ignored when the Panel is closed.
} Else
Return false;
}
});
});
In this case, the confirm window pops up when you click the red X or cancel | close button. Click OK to close the window and click Cancel to retain the window.
If you do not want to bring up a prompt, you can directly call: $ ('# W'). window ('close', true)