PDA

View Full Version : Create component from object



mkaw
6 Jun 2012, 7:18 AM
I have object like this:


var obj: {
xtype : 'panel',
title : 'my panel',
layout : 'fit'
}

How can I create extjs component in which I could use myComponentFromObject.add(myOtherComponent)?
I mean how to initialize myComponent.items of my component?

skirtle
6 Jun 2012, 12:40 PM
Using ExtJS 4.1:


var myComponentFromObject = Ext.widget(obj);

Using 4.0:


var myComponentFromObject = Ext.widget(obj.xtype, obj);

mkaw
6 Jun 2012, 1:12 PM
It is working! Thanks!