Search code examples
extjsextjs3

How can I reference the Form Ext Object through a listener?


     Mag.NewLightboxForm = Ext.extend(Ext.form.FormPanel, {
             initComponent: function () {
                 this.items = [{
                         fieldLabel: 'Select Image',
                         name: 'img',
                         //xtype: 'magcombo',
                         xtype: 'button',
                         id: 'selectlightboximage',
                         store: mageditcontentcombostore,
                         //hiddenName: 'type',
                         listeners: {
                                'render': function() { window.ele = this; }
                         }]
                 }
             });

In Ext 3.3, ele references the EXT Element. I'm trying to get the reference to NewLightboxForm dynamically so I can access .win and .hide() it.


Solution

  • Specify the scope in the listener:

    {
        render: function() {},
        scope: this
    }
    

    In the function, this will now point to the NewLightBoxForm instance.