PDA

View Full Version : [CLOSED][3.2.1] closeAction:'close' does not destroy window object



squ3lch
17 Jun 2010, 12:14 PM
Ext version tested:


Ext 3.2.1



Adapter used:


prototype



css used:


default ext-all.css



Browser versions tested against:


IE7
FF3



Operating System:


WinXP Pro



Description:


When using closeAction:"close" to destroy a window, the window object is not destroyed, and therefore cannot be recreated later. In the example below, "testWin" remains defined as an object after the window is closed. As I understand the documentation, using "close" should completely destroy the object and all items contained therein. If I'm wrong about how this is supposed to work I apologize in advance.



Test Case:



Ext.onReady(function(){

Ext.QuickTips.init();

var testCfg = {
xtype:'window',
closeAction:'close',
title:'test',
layout:'form',
shadow:'drop',
draggable:false,
resizable:false,
bodyStyle:{padding:'5px'},
width:350,
items:[
{
xtype:'textfield',
fieldLabel:'test',
width:200
}
]
};

var mainWindow = new Ext.Viewport({
layout:'border',
items:[
{
region:'center',
items:[
{
xtype:'button',
text:'Click Me',
handler:function(){
if (typeof(testWin)=='undefined') testWin = Ext.ComponentMgr.create(testCfg);
testWin.show();
}
}
]
}
]
});

mainWindow.doLayout();

});

evant
17 Jun 2010, 4:09 PM
This isn't a bug.

The destroy operation destroys the object from the dom, however there's no possible way we can set an external reference to a variable to null.

Essentially, you're doing this:



var x = new MyObj();
x.someMethod();
// x is now undefined?


Just because you call destroy, x still holds a reference to the object.