EasyUI Forum
May 03, 2024, 10:11:30 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: $.messager.alert Callback Doesn't Fire on Window Close, Only on Button Click  (Read 28632 times)
angers
Newbie
*
Posts: 11


View Profile Email
« 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.
« Last Edit: June 24, 2012, 07:29:32 AM by angers » Logged
angers
Newbie
*
Posts: 11


View Profile Email
« Reply #1 on: June 26, 2012, 07:41:29 AM »

And...no answer.
Logged
angers
Newbie
*
Posts: 11


View Profile Email
« Reply #2 on: June 28, 2012, 02:46:04 AM »

...
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 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
Logged
angers
Newbie
*
Posts: 11


View Profile Email
« Reply #4 on: July 01, 2012, 04:18:30 AM »

Very nice workaround. Thank you - I didn't think of this but should have realized it.
Logged
tomb
Newbie
*
Posts: 14


View Profile
« Reply #5 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...
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #6 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})
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!