View Full Version : Event propagation on inhereted component.

14 Aug 2009, 12:29 PM
Suppose I have a Ext.form.ComboBox.

I extend it, creating Ext.ux.ValiComboBox. When creating it, I set the focus event to do something.

in Ext.ux.ValiComboBox:

Ext.apply (this, {...});

What if upon instantiating with new Ext.ux.ValiComboBox comes another focus event, doing something different? Will doSomething still be executed?


new Ext.ux.ValiComboBox({
listeners: {
focus: doSomethingElse

What will happen? How can I say something like this: "No matter how the user defines the focus event, what I wrote in the component should execute no matter what.". So, if the user defines doSomethingElse, upon focus to be executed doSomething and then doSomethingElse.

Thanks very much

14 Aug 2009, 12:41 PM
Why would you make a subclass? Are you planning to add or override methods?

14 Aug 2009, 12:43 PM
I just hate to type everything things like lazyrenderer, lazyinit, the store, reader, proxy and so on.

So I have a subclass that initializes some of the properties and also does some things upon some events :)

What approach should I follow ?

14 Aug 2009, 12:46 PM
Use a function:

function createMySpecialCombo() {
return new Ext.form.ComboBox({

14 Aug 2009, 12:48 PM
Thank you. That's a very nice idea :D

But how could I do what I want with the events as I said in the first post?

Thank you :)

14 Aug 2009, 12:51 PM
Add listeners.

14 Aug 2009, 12:53 PM
Thanks a lot for helping, now I understood :)