PDA

View Full Version : Error while showing a window



yo_haha
18 Oct 2012, 1:20 AM
Hi,
I have a button that displays a window when clicking on it :


print = new Ext.Button({
iconCls: 'print',
tooltip: "Imprimer la carte",
handler: function(){
printDialog = new Ext.Window({
title: "Aperçu avant impression",
layout: 'border',
items: [mapPanelPrint, formPanel]
});
printDialog.setSize(415,355);
printDialog.on('show', function(){
printDialog.center();
});
printDialog.show();
}
});

The first click works fine with no problems. When I close the displayed window and click a again on the button, the window does not show and I get an error :


TypeError: me.dom is undefined




style = me.dom.style;




in file: ext-all-debug-w-comments.js line 10970.


There is a great chance that this error is linked to the objects inside the window: mapPanelPrint is of type GeoExt.PrintMapPanel() and formPanle is of type Ext.FormPanel that uses mapPanelPrint and another object of type GeoExt.data.PrintPage().
When I use other objects in the window, this error doesn't appear.

Do you have a hint?

Regards.

willigogs
18 Oct 2012, 1:27 AM
To diagnose whether it is the window causing the error, or one of the children items - try removing the children items (just add a blank panel for example), as test whether the same issue occurs. If no error occurs, add each child item in turn to locate which is causing the issue.

I'm also not sure why you are applying the setSize and center functions, since you could instead simply add height and width to the window's initial config, and all windows should be centered on show by default anyway?

yo_haha
18 Oct 2012, 2:02 AM
OK. The window centers by default.
I tryed what you said about children and, indeed, the errors comes from both children.
Now I don't know where to post my question about the children error since I didn't find a GeoExt Forum! Would it be fine if I posted in this forum?

yo_haha
18 Oct 2012, 4:26 AM
I found an answer here : http://www.sencha.com/forum/showthread.php?246338-TreePanel-in-a-Window-give-issue-when-the-Window-is-opened-2nd-time..-%28

I moved the components declaration and instantiation into the window and the error disappeared.