19 Nov 2007 4:42 PM #1
Questions about "complex layout" example in 2.0
Why is it that in the Items array (in the Viewport constructor) we instantiate some components but for others, we just list the config object for the component? (ex. 1st comp. is instantiated and 2nd is not)
How does Viewport constructor know what is the componant based on the config. object listed in the 2nd element of the Items array?
19 Nov 2007 6:36 PM #2
- Join Date
- Mar 2007
- DC Area =)
- Vote Rating
19 Nov 2007 7:00 PM #3
The Ext 2 Overview has a section on components and their xtypes that may help you understand better this topic, specially the concept of deferred object creation and rendering.
Also, there's the defaultType config property for Ext.Container, which defaults to 'panel'. That means that all the subclasses of Container (e.g. Viewport) assume that a config object with no xtype specified must be considered an Ext.Panel.Fernando G
19 Nov 2007 7:04 PM #4
In items you can have either a component object or the config of an object. Ext will figure it out. If you are passing a config then you can specify an xtype telling what type of component it is. eg. xtype:'tabpanel' for example. If you dont specify xtype default is as mentioned above. To see a list of xtype's see the docs for Ext.Component.