4

I have a panel like

 var filterPanel = Ext.create('Ext.panel.Panel', {
        bodyPadding: 5,
        width: 300,
        myValue:5,
        title: 'Filters',
        initComponent: function() {
            this.items = [{
                xtype: 'textfield',
                value: this.myValue
            }];
            this.callParent();
        }
        renderTo: Ext.getBody()
    }); 

i try to create a item has xtype: 'textfield' and value is myValue of panel. But that's fail.

How to do that thanks. Here is my example text http://jsfiddle.net/4Cmuk/

1 Answer 1

4

You are using Ext.create() function which is used to create instance of your class. initComponent method can be used while defining the class using Ext.define() function, I am not sure but initComponent function would not work using Ext.create() method.

For e.g. See below code, it will get execute:

Ext.define('customPanel', {
        extend: 'Ext.panel.Panel',
        bodyPadding: 5,
        width: 300,
        myValue:5,
        title: 'Filters',
        initComponent: function() {
            this.items = [{
                xtype: 'textfield',
                value: this.myValue
            }];
            this.callParent(arguments);
        },
        renderTo: Ext.getBody()
    }); 

Ext.create('customPanel');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.