PDA

View Full Version : c.container is undefined ,ext.destroy..



adibhagra
30 Nov 2009, 12:48 AM
hey guys,

i am trying to remove a combo box and a text box from my form based on the selection made by the user within the grid, also these combo boxes and text boxes are added dynamically .

my code is as follows:



//within the grid's 'rowselect' listener
if(record.data.amnesty == "Yes")
{
kir.combo.amAppCmb = kir.form.manage.getComponent('amAppCmb');
if(!kir.combo.amAppCmb)
{
kir.form.manage.add( kir.combo.amAppCmb = new Ext.form.ComboBox({
id:'amAppCmb',
fieldLabel:'Is Amnesty Approved?',
mode:'local',
width:93,
store:new Ext.data.SimpleStore({
fields:['appdisapp'],
data:[['Approved'],['Disapproved']]
}),
triggerAction: 'all',
displayField:'appdisapp',
listeners: {
'select': function(combo, record, index){

if (record.data.appdisapp == "Approved") {
kir.form.manage.remove('isVioDisCmb');
kir.form.manage.remove('defPenCmb');
kir.form.manage.remove('reqConRedCmb');
kir.form.manage.remove('penaltyCmb');
kir.form.manage.remove('redPenCombo');
kir.form.manage.remove('detJust');
Ext.getCmp('amAppCmb').setDisabled(true);
}
else {
kir.form.manage.getForm().findField('isVioDisCmb').setValue('No');
kir.form.manage.remove('otcOfDispute');
kir.form.manage.remove('prvValidJust');
Ext.getCmp('isVioDisCmb').setDisabled(true);
}

}
}
}));
}
kir.textarea.amJust = kir.form.manage.getComponent('amJust');
if(!kir.textarea.amJust){
kir.form.manage.add( kir.textarea.amJust = new Ext.form.TextArea({
fieldLabel:'Amnesty Approval/Disapproval Justification',
name:'amJustText',
id:'amJust',
width:352
}));
}
kir.form.manage.doLayout();
}
else{

kir.form.manage.remove('amAppCmb');
kir.form.manage.remove('amJust');// not being removed
}

however the text area 'amJust' is not being removed and firebug shows the error to be that c.container is undefined , if replace the order of my combo box and text box then the combo ie.'amAppCmb' is not removed and i get the same error.

any suggestions,

regards

ice

adibhagra
30 Nov 2009, 1:57 AM
doesn't anyone have any clue ??