PDA

View Full Version : adding items by Ext.getCmp()



lormitto
7 Mar 2010, 6:32 AM
Hi,

Could you please taka a look at code and advice what i do wrong. I can not access last items via id "centerPointer" using Ext.getCmp(). Is there anything wrong with this code in particular?


var viewport = new Ext.Viewport({
layout:'border',
items:[{
region:'west',
id:'west-panel',
title:'Menu',
split:true,
width: 200,
minSize: 175,
maxSize: 250,
collapsible: true,
margins:'0 0 0 0',
cmargins:'0 0 0 0',
layout:'accordion',
layoutConfig:{
animate:true
},
items: [{
title:'Customers',
autoScroll:true,
border:false,
iconCls:'nav',
items: tree
},{
title:''settings,
border:false,
autoScroll:true,
iconCls:'settings'
}]
},{
region:'center',
margins:' 0 0 0 0',
id: 'center',
layout: 'fit',
autoScroll:true,
items:[{
columnWidth: 1,
baseCls:'x-plain',
id: 'panelCenter',
layout: 'fit',
bodyStyle:'padding:5px 5px 5px 5px',
items:[{
layout: 'fit',
id: 'centerPointer',
items: [testTabPanel]
}]
}]
}]
});
Using code:



var centerPanel = Ext.getCmp('centerPointer');
var centerRegion = Ext.getCmp('panelCenter');
centerRegion.remove(centerPanel, true);
centerRegion.add({
layout: 'fit',
id: 'centerPointer',
items: [regCenter]
});



Removing is ok. However adding anything fails with firebug report: "this.view is null"


Thank you for any help.



Regards

lormitto
7 Mar 2010, 7:47 AM
Wisdom is something i miss


I managed to find solution - id was wrong