PDA

View Full Version : What's the difference between mon() and on()?



Baron89
6 Sep 2012, 10:34 PM
hi all,would u guys pls explain the difference between mon() and on()?

sword-it
6 Sep 2012, 11:35 PM
Hi Baron,

Both method are used for bind event handler to the component, mon() is slightly differ from on()-
Using mon you can bind event to any observable object in your application like


this.mon(any observable cmp, "mouseover", Fn, scope, opt)


while using on bind event to this object like



this.on("mouseover",Fn,scope);
or

myGridPanel.on("mouseover", Fn, scope);

Baron89
6 Sep 2012, 11:45 PM
Hi Baron,

Both method are used for bind event handler to the component, mon() is slightly differ from on()-
Using mon you can bind event to any observable object in your application like


this.mon(any observable cmp, "mouseover", Fn, scope, opt)


while using on bind event to this object like



this.on("mouseover",Fn,scope);
or

myGridPanel.on("mouseover",Fn,scope);
umm,why not directly set it like below?
Ext.getCmp(id).on("mouseover",Fn,scope);