I'm having difficulty getting this to work:
var fn = function(){};
Ext.select('ul > li').on('click',fn);
// works
Ext.select('ul > li').un('click',fn);
//doesn't work
'un'/'removeListener' does not work. Appreciate any help!
By default, Ext.select
creates a flyweight object, which does not remember event listeners. Thus, they cannot be removed later.
You need to create real Ext.Element
s by setting the second parameter to true
:
var fn = function(){};
Ext.select('ul > li', true).on('click',fn);
Ext.select('ul > li', true).un('click',fn);
Unfortunately, the docs are not very clear about this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With