Results 1 to 4 of 4

Thread: Can't get element after extension and some his properties

  1. #1

    Default Can't get element after extension and some his properties

    Hello,

    After class extension I can't get the element wrapper so getEl return null also getWidth returns this.getResizeEl() is undefined error.

    1) box.js - sub-class of Ext.Panel
    Code:
    Ext.namespace('Ext.xxx'); 
    
    Ext.xxx.MyBox = function(config) {
    
        if (Ext.isEmpty(config.layout)) {
            config.layout = 'anchor';
        }
        
        if (Ext.isEmpty(config.anchor)) {
            config.anchor = '100%';
        }
    
        // call parent constructor
        Ext.xxx.MyBox.superclass.constructor.call(this, config);
    };
    
    Ext.extend(Ext.xxx.MyBox, Ext.Panel, {});
    2) Create instance of Ext.xxx.MyBox
    Code:
            
            var box = new Ext.xxx.MyBox({
                id: 'test-box-id',
                title: 'TestBox',
                width: 400,
            });
    
            console.dir(box);
            console.log('==============');        
            console.log('getEl: ' + box.getEl());
            console.log('getId:  ' + box.getId());
            console.log(box.getWidth());
    Any idea?
    Thanks in advance.

  2. #2

    Default

    Something wrong in my actions?

  3. #3

    Default

    Issue can be closed.
    I've found error in the sequence of code flow.

  4. #4
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,488

    Default

    jsknight -

    The reason you were not able to access the element was because it had not been rendered yet.

    If you were to have used the renderTo configuration or had placed box within another container you would have been able to access the element.
    Aaron Conran
    @aconran

Posting Permissions

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