PDA

View Full Version : Multiple Window problem in Firefox but not in IE



i6004835
16 Apr 2012, 8:04 PM
I have a menu that when clicked show a new Window. When I click 2 times the menu then 2 same Windows appear as I wanted. The window just has a TextArea and two buttons: Save and Cancel. The cancel button will close the Window. When I click the cancel button at the first form, the first form is closed nicely. The problem is with the second form. The cancel button in the second form suddenly disappeared and left me just with a textarea and a save button. This happened in Firefox 11.0. But this is not happening when I open in Internet Explorer. Not yet test it with Chrome.

Note: I'm using ExtJS 4.07-gpl and below is my code to close the window.


btnCancelClick: function(btn,e,eOpts){
var frmFile = btn.findParentByType('frmfile');
frmFile.close();
}

Any help is appreciated.

skirtle
16 Apr 2012, 8:50 PM
How are you declaring the cancel button? Are you using a static id?

i6004835
16 Apr 2012, 9:07 PM
Well, yeah I just set the btnCancel id static.
Below is my code for the view.


Ext.define('Windowing.view.FrmFile' ,{
extend: 'Ext.window.Window',
alias : 'widget.frmfile',

title: 'File',
width: 300,
height: 200,

layout: 'fit',

items: [{
xtype: 'textareafield',
name: 'content',
fieldLabel: 'content',
labelAlign: 'top'
}
],

buttons:[{
id: 'btnSave',
text: 'Save'
},{
id: 'btnCancel',
text: 'Cancel'
}
]
});

i6004835
16 Apr 2012, 10:09 PM
The problem is done. It is due to static id in the buttons.

Solution: remove id in the buttons and assign click handler using this domquery: 'frmfile button[text=Cancel]' instead of '#btnCancel'.

Thanks for your help

fschaeffer
17 Apr 2012, 1:25 AM
or even better:

assign a action: 'cancel' to the button and then use DOM query action='cancel' so you're not bound to the displayed button's text ...