PDA

View Full Version : dynamic replace panel in border region



dave0224
2 Jul 2009, 1:55 AM
hi



how to dynamic replace panel which is in region of border layout.

this is my test code.


new Ext.Panel({
id:'main',
layout:'border',
renderTo: 'container',
width:800,
height:480,
items:[
{
region:'north',
html:'north',
id : 'northPanel',
title:'north',
height:'20%'
},
{
region:'west',
html:'west',
id : 'westPanel',
width:300
},
{
region:'center',
id : 'centerPanel',
width:300,
html:'center'
},
{
region:'east',
layout:'fit',
id : 'eastPanel',
width:200,
html:'east'
}

],
bbar : [
{text: 'create panel to center',
handler: function() {

var newPanel = Ext.ComponentMgr.create(
{
xtype:'panel',
region: 'center',
id:'content',
html:'hello world'
});

var container = Ext.getCmp('main');
container.remove( container.getLayout().center.panel.id ,true);
container.add( newPanel );
container.doLayout(true);

alert('container.doLayout success and newPanel.isVisible() = ' + newPanel.isVisible() );

}
}
]

});



why the panel isVisible is false ..? pease help.

dave0224
2 Jul 2009, 10:12 PM
i can find the solve ... :-|

Animal
2 Jul 2009, 11:13 PM
Create the region with layout: 'card'

Then it can contain many items, and you can add to it as needed. You can activate child items which brings tem to the front as needed.

luajiu
5 Jan 2010, 5:43 PM
i can find the solve ... :-|

how?