Animal
8 Oct 2008, 5:37 AM
Sometimes, it's useful just to be able to use raw DIVs or IMGs to add to Containers.
We power users know that they need to be encapsulated by a Component (In fact, a BoxComponent when the Container's layout deals with sizing), but others shouldn't have to bother if all they want to do is add "things" to a layout.
So I propose
lookupComponent : function(comp){
if(typeof comp == 'string'){
return Ext.ComponentMgr.get(comp);
} else if ((comp instanceof Ext.Element) || (comp.nodeType == 1)) {
return new Ext.BoxComponent({
el: comp,
style: {
display: 'block'
}
});
}else if(!comp.events){
return this.createComponent(comp);
}
return comp;
},
Create a BoxComponent out of any raw element being added into a Container.
We power users know that they need to be encapsulated by a Component (In fact, a BoxComponent when the Container's layout deals with sizing), but others shouldn't have to bother if all they want to do is add "things" to a layout.
So I propose
lookupComponent : function(comp){
if(typeof comp == 'string'){
return Ext.ComponentMgr.get(comp);
} else if ((comp instanceof Ext.Element) || (comp.nodeType == 1)) {
return new Ext.BoxComponent({
el: comp,
style: {
display: 'block'
}
});
}else if(!comp.events){
return this.createComponent(comp);
}
return comp;
},
Create a BoxComponent out of any raw element being added into a Container.