PDA

View Full Version : how to destroy the panel dynamically in extjs3.4



gokulpotluri
16 Jul 2013, 12:56 AM
Hi,
I am creating a panel with an id which is based on a flag


var that = this;
alert(1 + ", " + that.isClone + ", " + recordId)
var panelID = this.entityType + this.wfContext + recordId;
if(that.isClone)
panelID = this.entityType + this.wfContext + recordId + '_clone';
alert(2 + ", " + panelID)
this.panel = new Ext.Panel({
id : panelID,
title : 'Loading...',
layout: 'fit',
border: false,
autoScroll : true,
closable: true,
bodyStyle: {
'padding': '0px',
'background': '#FFFFFF',
'overflow-x': 'hidden'
},
getRequestObject : function(){
return that;
}
});


And i am trying to delete this panel(this.panel) in some other function which is in the same class



onSubmit : function(recordId){
alert(1 + ", " + this.panel + ", " + this.panel.id)
this.panel.destroy();
alert(2)
new sd.openRequest({
entityType : this.entityType,
wfContext : this.wfContext,
recordId : recordId,
aftercreate : this.aftercreate
});
}

but it is giving js error called 'Style' is null or not an object at the line this.panel.destroy(); after alert(1) in onSubmit function. Even alert(2) is not getting rendered.

Advance thanks for help.

willigogs
16 Jul 2013, 3:35 AM
Is this.panel returning an EXT Panel in order to run the destroy() function against?

Perform console.log() against "this" and "this.panel" (console.log(this, this.panel)) to see what the actual variable is.

I would always recommend using Firebug and Illuminations within Firefox when debugging, rather than alert().

https://getfirebug.com/
http://www.illuminations-for-developers.com/ (https://getfirebug.com/)