PDA

View Full Version : adding removing components dynamically



coooolmagic
9 Nov 2010, 3:27 AM
hi all

I am adding a grid like this dynamically in Tab Panel

var tab1 = Ext.getCmp('availableEmployeeTab');
tab1.add(buildDataGrid(u,"availableEmpGrid"));
tab1.ownerCt.doLayout();

Same way I want to remove this Grid based on some condition.

Having little issue in removing this.

Can you suggest me some way....

plalx
9 Nov 2010, 6:33 AM
Give an itemId to your grid, or store a reference to it so that you can retrive that component for removal afterwards.
By the way, if your tab contains a grid only, it might be overnested (the grid can be the tab directly).




new Ext.grid.GridPanel({
itemId: 'myGrid',
....
});

tab1.remove(tab1.getComponent('myGrid'));

tab1.doLayout();