Results 1 to 3 of 3

Thread: Can't Catch bewforeshow On Extended Ext.Window

  1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    8
    Vote Rating
    0
      0  

    Default 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
    18,427
    Vote Rating
    858
      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
      0  

    Default

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

    Cheers,

Posting Permissions

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