PDA

View Full Version : Removing event listeners



zeke
20 Sep 2012, 4:02 PM
Hello, I noticed that the option destroyable will be available as of version 4.1.2, but until then, how would you remove listeners added in the following manner:


myComp.addListener({
render: function(){
//dostuff
},
customevent: function(){
//domorestuff
},
scope:this
});

Thanks!

Farish
21 Sep 2012, 12:10 AM
take a look at this link:
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Element-method-un (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.Element-method-un)

adding a listener:

store.on('load', handlerFunction);

removing a listener:

store.un('load', handlerFunction);

zeke
2 Oct 2012, 5:38 AM
Thanks. I was hoping there was a way to do this without having to declare every function handler, but I guess I'll have to wait until 4.1.2 for that.