PDA

View Full Version : How to remove ComboBox



YeonJong Jeong
3 Dec 2010, 7:31 AM
Hi, I'm not good at using Ext JS and I'm wondering how to remove ComboBox.
I put my code below.

var cdata = [['P1-1','P1-1'],['P1-2','P1-2']];
var cbStore = new Ext.data.SimpleStore({
id : 0,
fields : ['value', 'display'],
data : cdata
});
var cbox = new Ext.form.ComboBox({
id : 'cSubPlant',
applyTo : 'subPlant',
valueField : 'value',
displayField : 'display',
editable : false,
store : cbStore,
triggerAction : 'all',
enableKeyEvents : true,
mode : 'local'
});

And here is the code I trid.

var cbInstance = Ext.getCmp("cSubPlant");
cbInstance.remove(); or cbInstance.destory();

However, it didn't work well.
Would you please give me some advice to settle it down ?

Screamy
3 Dec 2010, 9:19 AM
You must remove the ComboBox from it's parent Container. If your combo is inside of a panel, then you'd call :



panel.remove(Ext.getCmp("cSubPlant"));
panel.doLayout();

mitchellsimoens
3 Dec 2010, 10:32 AM
getCmp.... ewww

Screamy
3 Dec 2010, 11:42 AM
/face palms

Okay, fine then...



panel.remove(comboBoxReference);
panel.doLayout();