PDA

View Full Version : Ext Js how to change the xtype dynamically



shafi_363
1 Jul 2009, 3:41 AM
Hi,

I have a border layout whose center panel is defined like the below.


{
region:'center',
id:'Center',
layout:'fit',
xtype:'gridA'
}But on click of a button, I want to change the grid to 'gridB' through javascript programmatically. How can this be done.

I tried the following with no success.


1) Ext.getCmp('Center').xtype = 'gridB';

2) Ext.getCmp('Center').setxtype('gridB');

3) Ext.getCmp('Center').items.add({xtype:'gridB'});
Please suggest me the way through which this can be achieved.

Thanks
Sk

Animal
1 Jul 2009, 3:46 AM
Use card layout, and switch the activeItem between different items in tere.

3 Jul 2009, 5:13 AM
You don't set an xtype dynamically once an instance of a class has been derrived from the xtype!