PDA

View Full Version : Ext.Msg not understanding Y its happening



poojagarg89
6 Mar 2013, 11:12 PM
I have a Code for Button :



buttons:[{
text:"Click Me!!",
iconCls:'',
width: 100,
listeners:{
click: function(){
// Ext.Msg.alert("Delay By 5sec.",5000);
setTimeout(function(){
Ext.Msg.alert('Done', 'data saved!');
}, 5000);
}
},
handler: function(){
Ext.Msg.alert("Its Me");
}
}]



Here I have an alert msg in handler n one on click event in listeners...................
now what is happening that I have given 5000(5sec) delay to listeners msg....................

If I dont use the delay only handler msg shows up and listeners msg wont b coming But when I use delay tym..............It gives alert msg of handler first and then after 5secs it gives the listeners msg

Just want to know Y is this happening with n without delay timeout....................


Can someone provide me with an xplanation?

Thanks,
Pooja :)

willigogs
7 Mar 2013, 12:08 AM
I don't understand why you would use both the listener AND the handler?

Surely they're pretty much the same event, therefore just use one?

poojagarg89
7 Mar 2013, 12:48 AM
Ya m not using both I was just experimenting n was thinking Y they r showing such behavior so just wanna know about it................. :)

willigogs
7 Mar 2013, 1:46 AM
If you're not using both, then can you clarify what code you are using, and what the issue actually is (i.e. what are you expecting compared to what is actually happening)?

It also looks like you're using Ext messageboxes for your debugging needs, which is probably serious overkill. I would honestly recommend you just use console.log for such things as notifying you which section of code has been run.

e.g.
console.log('Handler Logic')