PDA

View Full Version : Attach listener to onchange event of legacy SELECT dropdown



mberrie
20 May 2012, 11:04 PM
I have a 'legacy' (non-Extjs) dropdown onto which I want to attach an onchange event listener - at runtime, using Ext. I thought I could do something like this:



// inside a controller's init() method
var el = Ext.fly('myselect'); // returns the dom node of the <select> element
el.on('change', this.onLegacyChange, this);

..

// still inside the controller
onLegacyChange: function(e) {
console.log(e);
}


What I get is an ExtJs event object with type: "mousemove"!?!



Can anybody shed some light on this? Is my approach correct?

Appreciate any help!

mberrie
22 May 2012, 7:40 PM
bump

vietits
22 May 2012, 10:45 PM
Let try by using Ext.get() instead of Ext.fly().


var el = Ext.get('myselect'); // returns the dom node of the <select> element
el.on('change', this.onLegacyChange, this);