PDA

View Full Version : pushing the button twice I get "this.el is NULL"



squalo
26 Jan 2011, 6:24 AM
Meanwhile i did research for hours but with no success.

Why the heck I can't get my Ext.window a second time on the same HTML site after closing it.

Going back and again forward in the browser, it works (or after a reload).



function showrelnotes(version)
{
var applied_wnd = 'rel-notes-' + version;
var applied_tab = 'rel-tabs-' + version;

//if(!win) {
var win = new Ext.Window({
applyTo: applied_wnd,
layout:'fit',
width:500,
height:300,
closeAction:'close',
plain: true,

items: new Ext.TabPanel({
applyTo: applied_tab,
defaults:{autoScroll: true },
autoTabs:true,
activeTab:0,
deferredRender:false,
border:false
}),

buttons: [{
text: 'OK',
handler: function(){
win.close();
}
}]
});
win.setPosition(100,200);
win.show(this);
};

Ext.onReady(function(){
Ext.get('rel-btn-2.15c').on('click', function() { showrelnotes('2.15c'); });
Ext.get('rel-btn-2.15b').on('click', function() { showrelnotes('2.15b'); });
Ext.get('rel-btn-2.14a').on('click', function() { showrelnotes('2.14a'); });

});
Any hints are appreciated.
Thx

squalo
26 Jan 2011, 7:25 AM
So, I got an answer and I will post it here for all others desperate /:) developers
Here is what is written in the API docs to the 'closeAction' config options of Ext.window:


The action to take when the close header tool is clicked:
'close' : Default remove the window from the DOM and destroy it and all descendant Components. The window will not be available to be redisplayed via the show method. So, okay. I have to create for every possible window from an ID a separate Ext.Window() instance and always hide them. An open array of 'win' should solve my problem, but how about resources?