Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

me.dockedItems error in ExtJS

Tags:

firebug

extjs4

I was trying to test out a script i write on firebug console and i think the script is simple enough. And when i ran the script, i got this error me.dockedItems is undefined. Here's the code i run from Firefox's firebug console:

Ext.create('Ext.window.Window',{
    title : 'Login',
    width : 400,
    height : 500,
    initComponent : function() {
        var me = this;

        var usernameField = Ext.create('Ext.form.field.Text',{
            fieldLabel : 'Net ID',
            allowBlank : false,
            labelWidth : 150,
            width : 150,
            emptyText : 'Net ID'
        });

        var passField = Ext.create('Ext.form.field.Text',{
            fieldLabel : 'Password',
            allowBlank : false,
            labelWidth : 150,
            width : 150,
            emptyText : 'Pass'
        });

        this.items = [usernameField,passField];
        this.callParent(arguments);
    }
}).show();

I appreciate your help to find what is wrong with the code

like image 925
auphali Avatar asked Jul 18 '12 07:07

auphali


2 Answers

I got this error when doing

Ext.define('blah', {

    initComponent: function(){
        //do stuff
    }
});

It turns out this question was sortof pointing the right direction but you will also get this mysterious error if you don't call

this.callParent(arguments);

at the end of initComponent. Useful!

like image 112
JonnyRaa Avatar answered Sep 23 '22 11:09

JonnyRaa


Don't override initComponent when creating an instance.

Ext.create('Ext.window.Window', {
    title: 'Login',
    width: 400,
    height: 500,
    items: [{
        xtype: 'textfield',
        fieldLabel: 'Net ID',
        allowBlank: false,
        labelWidth: 150,
        width: 150,
        emptyText: 'Net ID'
    }, {
        xtype: 'textfield',
        fieldLabel: 'Password',
        allowBlank: false,
        labelWidth: 150,
        width: 150,
        emptyText: 'Pass'
    }]
}).show(); 
like image 30
Evan Trimboli Avatar answered Sep 22 '22 11:09

Evan Trimboli