1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    8
    Vote Rating
    0
    fatboab is on a distinguished road

      0  

    Default Can't Catch bewforeshow On Extended Ext.Window

    Can't Catch bewforeshow On Extended Ext.Window


    Hello,

    I was defining a window like:

    Code:
    var window = new Ext.Window({
        ....
    });
    window.on('beforeShow', function() {
        ...
    });
    Which was okay, but I need to extend Ext.Window now to fit in with the rest of an application. I've successfully extended Ext.Window for other components, but I've not needed to capture the beforeshow and show events before. I had a look that the extending Ext components tutorial and this is what I'm doing:

    Code:
    MyWindow = function() {
        
        // Call parent constructor and pass the config...
        MyWindow.superclass.constructor.call(this, {
            ...
        });
        
        this.on({
            beforeshow: {
                scope: this,
                fn: function(component) {
                    Ext.Msg.alert('beforeShow...');
                }
            },
            show: {
                scope: this,
                fn: function(component) {
                    Ext.Msg.alert('show...');
                }
            }
        });
        
    }
    
    // Make the MyWindow extend the Ext.Window class...
    Ext.extend(MyWindow, Ext.Window, {
        // ::TODO:: Put other config stuff here...
    });
    I get the alert popup for the show event, but not the beforeshow event. I also don't get any popups if I put in onShow: or onBeforeShow: config params in the call to the super constructor either.

    What am I doing wrong...?

    Thanks,

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,664
    Vote Rating
    584
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Events are bound in initComponent. So the event isn't registered when you're binding it in the constructor. You should override initComponent.

  3. #3
    Ext User
    Join Date
    Jan 2008
    Posts
    8
    Vote Rating
    0
    fatboab is on a distinguished road

      0  

    Default


    Ah, okay, will put it in the other bit.

    Cheers,

Thread Participants: 1