PDA

View Full Version : Problem closing window with chart IE



supercharge2
12 Jun 2009, 7:07 AM
I am using IE8. When ever I display a chart in a window, it errors on closing of the window with the following error:


Line: 1
Error: 'null' is null or not an object

This doesn't happen in FF3. I am posting the following example that can be run to demonstrate the problem. I have seen this problem in 3.0 RC1.1 & 3.0 RC2.


var data = [['Ext JS', 115000], ['jQuery', 250100], ['Prototype', 150000], ['mootools', 75000], ['YUI', 95000], ['Dojo', 20000], ['Sizzle', 15000]];
var store = new Ext.data.ArrayStore({
fields: [{
name: 'framework'
},
{
name: 'users',
type: 'float'
}]
});
store.loadData(data);
var pieChart = new Ext.chart.PieChart({
store: store,
url: 'ext-3.0-rc2/resources/charts.swf',
dataField: 'users' // <-- this is very important!!
});
var win = new Ext.Window({
title: 'Pie chart example',
width: 450,
height: 300,
bodyStyle: 'background-color:#fff',
items: [pieChart]
});
win.show();

Any help is greatly appreciated.

normanhab101
5 Aug 2009, 9:00 AM
I've got the same problem. Hope somebody help us!

RamsesAkaPus
29 Aug 2009, 12:26 AM
having the same problem. when I try to close the window it gives nearly the same error. but nothing in FF. hope somebody helps.

RamsesAkaPus
29 Aug 2009, 12:30 AM
not a solution but passed the problem with windows closeAction parameter. I set it to "hide" rather than "close" and now works. but stays in browser cache and using resources. I think it is about destroying the flash component. because same window with no chart doesn't act like the same.

Condor
29 Aug 2009, 1:13 AM
This problem has already been solved in SVN.

Try this patch:

Ext.override(Ext.chart.Chart, {
onDestroy: function(){
Ext.chart.Chart.superclass.onDestroy.call(this);
this.bindStore(null);
var tip = this.tipFnName;
if(!Ext.isEmpty(tip)){
delete window[tip];
}
}
});

supercharge2
31 Aug 2009, 6:56 AM
Thank you for all the help on this issue. This overide worked great for the pie chart. Didn't solve it for my column chart but after a little debugging I found that the tip part of the overide was the problem I altered the overide and now it works for all my charts.



Ext.override(Ext.chart.Chart, {
onDestroy: function(){
Ext.chart.Chart.superclass.onDestroy.call(this);
this.bindStore(null);
//var tip = this.tipFnName;
//if(!Ext.isEmpty(tip)){
// delete window[tip];
//}
}
});

Matthias_WB
14 Oct 2009, 10:33 AM
@supercharge2
I don't understand, why is the problem solved when you comment some lines from the codes?


@all
Can anyone confirm that the problem is solved for all diagrams??

elishnevsky
15 Oct 2009, 8:33 AM
This fix doesn't work in IE because IE doesn't allow window members to be deleted with delete keyword, even those added by the developer, which is dull (like everything in IE). You can try something as simple as this:


window.mymember = "hello";
delete window.mymember;

You'll get an error.

supercharge2
15 Oct 2009, 12:43 PM
@supercharge2
I don't understand, why is the problem solved when you comment some lines from the codes?


@all
Can anyone confirm that the problem is solved for all diagrams??


Works for me in IE, I have had no more problems since that code addition. I am running the charts in portal widgets that can dynamically be added and closed, so this was a major problem for me, as it threw an error every time a widget was closed. I am currently running Ext 3.0.0, IE 8, Firefox 3.5.3.

dillon
19 Nov 2009, 9:50 AM
This problem has already been solved in SVN.

Try this patch:

Ext.override(Ext.chart.Chart, {
onDestroy: function(){
Ext.chart.Chart.superclass.onDestroy.call(this);
this.bindStore(null);
var tip = this.tipFnName;
if(!Ext.isEmpty(tip)){
delete window[tip];
}
}
});

Thank you for this. I spent all morning trying to get chart panels to remove from IE. This override made the panels remove as expected.

hendricd
19 Nov 2009, 9:55 AM
@elishnevsky is quite correct. Earlier (pre IE8) versions will throw an error if you try to delete anything from the window object. Need to account for that:



Ext.override(Ext.chart.Chart, {
onDestroy: function(){
Ext.chart.Chart.superclass.onDestroy.call(this);
this.bindStore(null);
var tip = this.tipFnName;
if(!Ext.isEmpty(tip)){
try{ delete window[tip]; } catch(de) { window[tip] = null; }
}
}
});