PDA

View Full Version : "this.doc is undefined " after Ext.Window is closed/destroyed



netzloesungen
8 May 2010, 4:14 AM
Hello,

i updated an application to extjs 3.2.1. When ever i open an Ext.Window and close it again (either by calling .close or by calling Ext.destory(WindowID)) i get the following error on mouseover of any element in Firebug:


this.doc is undefined
[Break on this error] this.doc.un('mouseover', this.monitorMouseOver, this);
(ext-all-debug.js (Line 46303))

Chrome DevTools show the following error on this event:


"Uncaught TypeError: Cannot call method 'un' of undefined"

Here is an complete example of one of the windows that shows up including all the buttons and so on:


if(Ext.type(module_dohpv_form_popup_NewVersicherer) != false){

var module_dohpv_form_NewVersicherer = new Ext.form.FormPanel({
id: 'modul_dohpv_panel_newversicherer',
border: true,
frame: true,
fileUpload: true,
labelWidth: 100,
height: 400,
width: 500,
defaults: {
anchor: '96%',
allowBlank: false
},
baseCls: 'x-plain',
items: [{
name: 'cms_name',
xtype: 'textfield',
fieldLabel: 'Versicherung'
},{
name: 'cms_tarif',
xtype: 'textfield',
fieldLabel: 'Tarif'
},{
xtype: 'checkbox',
name: 'cms_infrontendsichtbar',
fieldLabel: 'In Frontend sichtbar',
boxLabel: ''
},{
xtype: "tinymce",
name: 'cms_anmerkung',
fieldLabel: 'Anmerkung',
id: 'cms_anmerkung',
ctCls: 'stylehtmleditor',
width: 470,
height: 200,
tinymceSettings: {
theme : "advanced",
theme_advanced_toolbar_location : "top",
plugins: "safari,style,table,advhr,advimage,advlink,insertdatetime,preview,media,searchreplace,contextmenu,paste,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
theme_advanced_buttons2 : "copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,,code",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl,template",
//theme_advanced_buttons4 : "styleprops,|,cite,abbr,acronym,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_align : "left",
theme_advanced_resizing : true,
theme_advanced_statusbar_location : "bottom",
template_external_list_url : "/_scripts/tiny_mce/template_list.js",
convert_urls : false
}

},{
xtype: 'fileuploadfield',
allowBlank: true,
id: 'form-file',
emptyText: 'PDF wählen...',
fieldLabel: 'Bedingungen (PDF)',
name: 'cms_bedingungen',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}

}],
buttons: [{
text: 'Speichern',
handler: function(){
if(module_dohpv_form_NewVersicherer.getForm().isValid()){
module_dohpv_form_NewVersicherer.getForm().submit(
{
url: 'module/dohpv/save_versicherer.php',
waitMsg: 'Daten werden gespeichert...',
success: function(){
Ext.destroy(module_dohpv_form_popup_NewVersicherer);
//module_dohpv_form_popup_NewVersicherer.close();
modul_dohpv_store_grid_versicherungen.load();
} // success
});
} // if
} // handler
},{
text: 'Abbrechen',
handler: function(){
//module_dohpv_form_popup_NewVersicherer.close();
Ext.destroy(module_dohpv_form_popup_NewVersicherer);
}
}]
});


module_dohpv_form_popup_NewVersicherer = new Ext.Window({
//id: 'stammdaten_form_newVersicherungDohpPopup',
title: 'Neue Datei hinzufügen',
closable: false,
resizable: false,
modal: true,
bodyStyle: 'padding:10px 5px 5px;',
items: [module_dohpv_form_NewVersicherer]
});

module_dohpv_form_popup_NewVersicherer.show();

}

}


I really have no idea what i am doing wrong and would be happy for any help. Thanks.

VladDidenko
9 Jan 2011, 10:14 AM
Were you able to find the cause? I seem to have exactly the same issue.

Thank you!

skirtle
9 Jan 2011, 2:16 PM
@VladDidenko, are you able to post a simple example that generates this error? I had a go with the original example but once I'd made the changes required to get it to work it didn't exhibit the problem.

Looks like it's a problem with the mouseover listener for the close button not being unregistered when the window is destroyed but it isn't immediately obvious why that would be.

VladDidenko
9 Jan 2011, 4:07 PM
I seem to run into the same issue - as I simplify the code, the problem goes away. I'll need to dig deeper.

netzloesungen
9 Jan 2011, 10:03 PM
I did not manage to get rid of the problem. I updated to the latest stable version of extjs 3.3.1 but that did not fix the problem. The example i posted above is part of a quite big application and it does show the issue when i run it inside the application....

I would be happy to provide anything needed to get this issue fixed. Please let me know...

thanks a lot!

skirtle
10 Jan 2011, 3:22 PM
@netzloesungen, try cutting out the fields, buttons, etc. one by one until the problem stops happening. One you've reduced it down to the minimum code that still exhibits the problem, post that.

VladDidenko
11 Jan 2011, 7:36 PM
I need some faster help with this issue, so I posted the test case and the video link at the premium forums: http://www.sencha.com/forum/showthread.php?120998

Please, review the post to make sure it actually reflects the same issue you are experiencing.

VladDidenko
13 Jan 2011, 9:43 AM
@netzloesungen, my finding is that FireQuery creates the issue (discussed in the other forum). Does it correspond with your environment?

netzloesungen
27 Jan 2011, 7:03 AM
@VladDidenko: Sorry for now replaying somehow i did nort receice an email about your new posts...

Unfortunately i do not use firequery and do not have it installed... i will now check out your post in the premium support forum...

netzloesungen
28 Jan 2011, 1:35 AM
@VladDidenko: Your video shows exactly the problem! As mentioned already i do not use firequery. Did uninstalling that extension resolve your problem? i can hardly believe this was the only reason for this issue...i will have some hours now to go into this issue and report back if i find out anything new...

netzloesungen
28 Jan 2011, 8:21 AM
Spent some hours to figure the problem out but could not. After the window is destroyed the issue remains.

@VladDidenko: i modified the ext-all-debug.js (version 3.3.0) on line 31154 (on mouse over function of the button class) and inserted a console.log(this):




monitorMouseOver :
function(e){
if(e.target !=
this.el.dom &&
!e.within(this.el)){

console.log(this);

if(this.monitoringMouseOver && this.doc !=
undefined){

this.doc.un('mouseover', this.monitorMouseOver,
this);

this.monitoringMouseOver =
false;

}

this.onMouseOut(e);

}
},


The result was that after the window was closed the button (the one in the window that was closed) seemed not to be destroyed correctly. Firebug printed out some references to the label of the button when i hovered on any extjs element. Can you confirm that?

The good thing is that after all, in my case i upgraded the tinymce plugin to the latest version an now it works. But i do not feel like having fixed the problem.....

Kind regards

Andy