PDA

View Full Version : custom events



pex
27 Apr 2007, 1:11 AM
How would I go about extending combobox with my own event handlers. For example, say I wanne add a 'hover' event?

Now I use this:


Ext.form.ComboBox.prototype.onHover = function() {
this.innerList.on('mouseover', function(){console.log('asdf')}, this);
};

then I have to call combo.onHover(); to get the behaviour, but what I would like is if I can use
combo.on("hover", function(){console.log('hovered')});

Or even better:

combo.on("hover", function(e, item){console.log('hovered item '+ item)});

brian.moeskau
27 Apr 2007, 3:41 AM
combo.el.on('mouseover', function(){
console.log('combo mouseover');
});

pex
27 Apr 2007, 11:49 AM
ah, thanks :) I love short and simple solutions