Reputation: 1229
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!
Upvotes: 5
Views: 8507
Reputation: 153234
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.
Upvotes: 12