EasyUI Forum

General Category => Bug Report => Topic started by: angers on June 24, 2012, 07:27:51 AM



Title: $.messager.alert Callback Doesn't Fire on Window Close, Only on Button Click
Post by: angers on June 24, 2012, 07:27:51 AM
$.messager.alert("ERROR",
                "COMMUNICATIONS ERROR.<br/>Please check your internet connection.",
                "error",
                function(){
                    window.location.href = '';
                }
);


A messager alert box can be closed 2 ways. Either by clicking the automatically generated "Ok" button OR by clicking on the close window icon at the top of the alert box. Since there is no closable:false option on $.messager, the user has the option to exit an alert box without triggering the callback.

Please fix.


Title: Re: $.messager.alert Callback Doesn't Fire on Window Close, Only on Button Click
Post by: angers on June 26, 2012, 07:41:29 AM
And...no answer.


Title: Re: $.messager.alert Callback Doesn't Fire on Window Close, Only on Button Click
Post by: angers on June 28, 2012, 02:46:04 AM
...


Title: Re: $.messager.alert Callback Doesn't Fire on Window Close, Only on Button Click
Post by: stworthy on June 28, 2012, 05:42:34 PM
There are no options to disable the closable button for messager in current version. The messager is created based on window, so there has one way to hide this closable button. The code below shows this usage:
Code:
$.fn.window.defaults.closable = false;  // disable the closable button
$.messager.alert('My Title','Here is a message!');
$.fn.window.defaults.closable = true;  // restore the closable button


Title: Re: $.messager.alert Callback Doesn't Fire on Window Close, Only on Button Click
Post by: angers on July 01, 2012, 04:18:30 AM
Very nice workaround. Thank you - I didn't think of this but should have realized it.


Title: Re: $.messager.alert Callback Doesn't Fire on Window Close, Only on Button Click
Post by: tomb on August 26, 2014, 09:23:30 AM
Is this supposed to be fixed in the current version?  It's still not working for me.  I have the same problem with $.messager.confirm which breaks a ton of my logic...


Title: Re: $.messager.alert Callback Doesn't Fire on Window Close, Only on Button Click
Post by: stworthy on August 26, 2014, 04:13:13 PM
Try the code below to hide the 'close' icon for the confirm window.
Code:
var win = $.messager.confirm('My Title', 'Are you confirm this?', function(r){
if (r){
alert('confirmed: '+r);
}
});
win.window({closable:false})