EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: korenanzo on April 29, 2016, 01:25:02 AM



Title: escape from messager.confirm
Post by: korenanzo on April 29, 2016, 01:25:02 AM
Hi,

when using messager.confirm you have a message and two  (OK Cancel) buttons;
in the callback function I can test the result, that is which button the user has pushed;

problem is that the user can escape from the window using the X icon or the ESC key

In this case the callback function is NOT called and the programmer can loose the control.

I'd like to remove the "X" tool icon and change  the ESC behaviour, is it possible?
thanks, RIc


Title: Re: escape from messager.confirm
Post by: jarry on April 29, 2016, 05:59:13 AM
When close the message window, the 'onClose' event fires. If you click the 'Ok Cancel' buttons, the callback function 'fn' will be called. If you press ESC key, only the 'onClose' event fires.
Code:
$.messager.confirm({
title:'Title',
msg:'message.',
closable:false,
onClose:function(){
console.log('onClose')
},
fn:function(r){
console.log(r)
}
})


Title: Re: escape from messager.confirm
Post by: korenanzo on April 29, 2016, 07:58:55 AM
thank you :)