Results 1 to 7 of 7

Thread: Event propagation on inhereted component.

  1. #1

    Arrow Event propagation on inhereted component.

    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:

    Code:
    Ext.apply (this, {...});
    Ext.ux.ValiComboBox.superclass.blabla
    this.on('focus',doSomething);
    What if upon instantiating with new Ext.ux.ValiComboBox comes another focus event, doing something different? Will doSomething still be executed?

    Example:

    Code:
    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

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Why would you make a subclass? Are you planning to add or override methods?

  3. #3

    Default

    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 ?

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Use a function:

    Code:
    function createMySpecialCombo() {
        return new Ext.form.ComboBox({
            blah...
        });
    }

  5. #5

    Default

    Thank you. That's a very nice idea

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

    Thank you

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Add listeners.

  7. #7

    Default

    Thanks a lot for helping, now I understood

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •