PDA

View Full Version : Strange error - appears only on IE8 - not on FF or Chrome



yallonb
3 May 2011, 6:29 AM
Hi.

I have a program I've written. If works great on FF (3.6.17) and Chrome (11), but on IE8, for some reason, it gives me this error:


User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Timestamp: Tue, 3 May 2011 14:16:11 UTC


Message: 'events' is null or not an object
Line: 31579
Char: 13
Code: 0


Please help ASAP, I need to sort this out on IE until tomorrow. Thanks.


Here is the code of the HTML file:


<html>
<head>
<title>Grid</title>
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="1.css" />

<script src="../adapter/ext/ext-base.js"></script>
<script src="../ext-all-debug.js"></script>
<script src="transparent_gif_4_all.js"></script>
<script src="1.js"></script>

<script>
Ext.onReady(function(){
initGrid({
height:240, //Grid height
width:650, //Grid width
title:'My Movie Database' // Grid title
})
});
</script>
</head>
<body>
<div id="div1" style="border:solid 1px blue;"></div>
<!-- Nothing in the body -->
</body>
</html>


and here is the "1.js" JavaScript file code:




var Movie = Ext.data.Record.create([
'id',
'title',
'director',
'runtime',
{name: 'released', type: 'date', dateFormat: 'Y-m-d'},
'genre',
'tagline',
{name: 'price', type: 'float'},
{name: 'available', type: 'bool'},
{name: 'boxoffice', type: 'int'}
]);




//Defining a "JSON" based store
var store2 = new Ext.data.Store({
url: 'movies.json',
reader: new Ext.data.JsonReader({
root:'rows',
idProperty:'id'
}, Movie),
autoLoad: true
});

var renderBoxoffice = function(value) {
if(value < 0) return "<span class='negative-cell'>" + value + "</span>";
else return "<span>" + value + "</span>";
}

var colModel_1 = new Ext.grid.ColumnModel({
defaultSortable: false,
columns: [
{header: "Title", dataIndex: 'title', sortable: true},
{header: "Director", dataIndex: 'director'},
{header: "Released", dataIndex: 'released', xtype: 'datecolumn', format:'d/m/Y'},
{header: "Genre", dataIndex: 'genre', width:40},
{header: "Tagline", dataIndex: 'tagline', width: 150},
{header: "Box Office", dataIndex: 'boxoffice', renderer: renderBoxoffice}
]
});

var initGrid = function(myConfig){
var grid1 = new Ext.grid.GridPanel({
renderTo: Ext.get("div1"),
tbar: new Ext.Toolbar({
items: [
{
text: 'Hide Negative Box Office',
handler: function(btn) {
var store = grid1.getStore();
store.filterBy(function(row) {
//return FALSE to filter out the record:
return (row.get('boxoffice') > 0); //FALSE if negative
});
}
},
{
text: 'Show All Records',
handler: function(btn) {
var store = grid1.getStore();
store.reload();
}
},

]}),
frame: true,
title: myConfig.title,
height: myConfig.height,
width: myConfig.width,
store: store2,
/*
view: new Ext.grid.GridView({
getRowClass: function(row,index){
if (row.data.boxoffice < 0)
return 'negative-row';
}
}),
*/
listeners: {
rowclick: function(grid,rowIndex,evt){
var store1 = grid.getStore();
var myRecord = store1.getAt(rowIndex);
var movieTitle = myRecord.get('title');
Ext.Msg.alert('Row Click','You have just clicked ' + movieTitle);
}
/*
rowDblclick: function(grid,title){

}
*/
},

cm: colModel_1
});

grid1.on('rowclick',function(grid, rowIndex){
/*
1. get this row's boxoffice value
2. if boxoffice < 0 set row obj css to red
*/
var row;
var boxOffice;
});

};

friend
3 May 2011, 6:43 AM
You're missing a semi-colon after the var renderBoxoffice = <...> function.

yallonb
3 May 2011, 6:50 AM
Thanks Friend. I fixed it, but it still gives me the same error :-(

yallonb
3 May 2011, 7:57 AM
I've fixed it. Thanks friend.

wiz61
3 May 2011, 11:57 AM
Getting similar error. How'd you fix it? was it missing semi-colons?

yallonb
3 May 2011, 9:10 PM
Nop. It was an extra , after a } (that is, after the } of the last element of an array).

Hope this helps.