PDA

View Full Version : dubble window in one window



ballibum
24 Nov 2009, 12:49 AM
Hello Forum,
i am opening a new Ext.window by clicking on a button.
If i am closing the window and open it again, i have got two windows in one window, that is not what i want.
can someone help me please?

that is my code:
function button2(){
alert(parent.frames['main'].document.getElementById('fenster')) ;
jahreszahl=parent.frames['main'].document.getElementById('jahr').value;
// parent.frames['main'].document.getElementById('fenster')[0].removeChild();
if(jahreszahl=='Wählen Sie ein Jahr...')
{
win = new Ext.Window({
applyTo:'fenster',
animCollapse: false,
layout:'fit',
autowidth:true,
autoheight:true,
closeAction:'hide',
plain: false,
html: 'Bitte Fenster schließen und <br> Jahr auswählen - Danke!',
buttons: [{
text: 'Schließen',
handler: function(){
win.hide();
}
}]
});
}
else
{
win = new Ext.Window({
applyTo:'fenster',
animCollapse: false,
layout:'fit',
autowidth:true,
autoheight:true,
closeAction:'hide',
plain: false,
html: 'Hier erscheinen die Empfehlungen zur Bekämpfung des MWB',
items: new Ext.Panel({
width: 600,
height: 400,
items: {
xtype: 'linechart',
store: store,
xField: 'year',
yField:'anzahl'
}
}),
});
}
win.show(this);
}// JavaScript Document

CrazyEnigma
24 Nov 2009, 8:54 AM
The problem is when you are hiding the window, you are not destroying the window, you are hiding it. So when it comes time to open a new window you are creating another one and showing possibly both. So you need to implement either destroying the window or determine if the window has already been created to just show the window.