PDA

View Full Version : How to replace one panel by another in Ext.Windows



pawan_chand
28 Aug 2012, 1:47 AM
Hi SenchaI have two panels QryInfoPnl1 and QryInfoPnl2. I am adding QryInfoPnl1 in Ext.Windows items by default. but i want to replace panel1 by panel2 on the button event which is present in the Ext.Windows.I want to see the panel2 on the button click.I am trying below properties for replacing but i am getting the error:winShowAddQryInfo.removeAll();winShowAddQryInfo.add(QryInfoPnl2);winShowAddQryInfo.doLayout();Please helpPlease help

sword-it
28 Aug 2012, 4:21 AM
Hi,


Try following code:




var win=Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: 'form',
bbar:[{
text:'changePanel'
, scope:this
, handler:function(btn){
win.remove('panel1');
win.add(new Ext.panel.Panel({
title:'Panel2'
, html:'Hi'
, height:100
, collapsible:true
}))
}
}],
items: {
xtype:'panel'
, html:'Hello World!'
, title:'Panel1'
, id:'panel1'
, height:100
, collapsible:true
}
}).show();

friend
28 Aug 2012, 6:45 AM
Also consider using a Card (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.layout.container.Card) layout on your Window, if you have need to switch back and forth between the two child panels.