EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: catpaw on January 16, 2014, 06:18:19 PM



Title: how cancel onshowPanel event of a combogrid
Post by: catpaw on January 16, 2014, 06:18:19 PM
hi everybody!

How I can send a message (messager) confirmation before people choose another option on a combogrid?

What event would launch the message?

when they click the arrow of a combogrid to be asked:

Already save yours changes?

if yes -> that allows you to select
if the answer is no -> to be able to keep you cancel the event onshowPanel combogrid

thanks


Title: Re: how cancel onshowPanel event of a combogrid
Post by: stworthy on January 17, 2014, 12:14:34 AM
No events can be used to interrupt the clicking action on arrow. But you can re-bind the click event on arrow to handle your own logic.
Code:
$(function(){
var cg = $('#cg'); // the combogrid
cg.next().find('.combo-arrow').unbind('.combo').bind('click.combo',function(e){
var p = cg.combogrid('panel');
if (p.is(':visible')){
cg.combogrid('hidePanel');
return;
}
$.messager.confirm('Confirm','Already save yours changes?',function(r){
if (r){
cg.combogrid('showPanel');
}
});
});
});


Title: Re: how cancel onshowPanel event of a combogrid
Post by: catpaw on January 17, 2014, 10:11:07 AM
ok it works!!

thank you