View Full Version : Destroy a window on a page with multiple versions of the same windows...?

14 Dec 2009, 10:10 PM
Hey guys,

I'm having a seemingly simple problem, hoping someone can elaborate.

I have a page with multiple links that open the same window (just with some different vars). By default, when I am using:


Sure it closes the window but then when I open a another one, the first windows variables are used (I am am pretty sure this is happening since the first window isn't destroyed, only hidden).

If I use:


Which I believe properly destroys the element from the dom, none of my windows can be opened any more.

How do I make the window close but still available for new windows?

14 Dec 2009, 10:50 PM
Not too sure how you are creating your object.

var winCfg = {};
Ext.apply(winCfg, originalWinCfg, { // Any missing Configurations });
var win = new Ext.Window(winCfg);

What apply does is takes the originalWinCfg and copies it to winCfg, and any missing configurations, can come from the new config.

This only copies one deep, so if you are trying to mesh other parts, it's a little more complicated - for example listeners.

15 Dec 2009, 8:09 AM
Wow, thanks man, that is working perfectly. I wasn't aware of this technique.


15 Dec 2009, 9:54 AM
not sure how did you do it. I am having the same issue.

I have a grid button Add new and on click I am opening another window which have 3 more panels on autoload.

when I close this window using




Its somehow hidden and not destroyed completely.

I am using EXTJS 2.x

15 Dec 2009, 12:28 PM
I'm just closing them like so (assuming the window var is win like in his example):


That's attached to a cancel button in my case.