PDA

View Full Version : Combo problem in ie8



stephencwatson
19 Jul 2009, 2:50 PM
I am learning Ext js and created a simple form as follows. It works fine in FireFox. It worked fine on ie8 until I added the combo. On ie8 I get the JavaScript error message:

Message: 'events' is null or not an object
Line: 17593
Char: 15
Code: 0
URI: http://localhost:8082/Tabs_Prototyping/ext/ext-all-debug.js

My code:

Ext.onReady(function(){


var lobList = new Ext.data.SimpleStore(
{fields:['id', 'lob'],
data:[['1', 'Front Load'],['2','Rearload'],['3','Roll Off']]
});
var lob_submit = new Ext.FormPanel({
url:'xyz.com',
renderTo:document.body,
frame:true,
width:350,
items:[
{xtype:'combo',
name:'lobSelect',
fieldLabel:'LOB',
mode:'local',
store:lobList,
displayField:'lob',
emptyText:'Select a state...'
},
{xtype:'textfield',
fieldLabel:'Product',
name:'product'
},
{xtype:'datefield',
fieldLabel:'Created',
name:'dateCreated'
},
{xtype:'textfield',
fieldLabel:'Name',
name:'name'
},
]
})

});

I am using ext-3.0-rc3, running locally on TomCat.

Steve Watson

steffenk
19 Jul 2009, 4:15 PM
use www.jslint.com with your code, you have an extra comma at the end

stephencwatson
19 Jul 2009, 4:30 PM
Thanks.

Lukman
19 Jul 2009, 10:32 PM
Make it a habit to put the comma at the start of the line instead of at the end:



{
title: 'My Window'
, floating: true
, shim: false
}


It's easier to catch dangling commas.

Condor
19 Jul 2009, 10:37 PM
The only problem with that is that I hate the way that looks.

I would recommend using a good javascript editor that shows trailing commas as errors (e.g. Aptana).

Lukman
19 Jul 2009, 10:51 PM
You'll get used to it. I know I will B)

tryanDLS
20 Jul 2009, 6:07 AM
Make it a habit to put the comma at the start of the line instead of at the end:



{
title: 'My Window'
, floating: true
, shim: false
}


It's easier to catch dangling commas.

Please don't make that blanket recommendation. We've had this discussion before in other threads and don't need to resurrect.

MD
20 Jul 2009, 6:14 AM
That occurs by default? I only switched over to Apatana a few months ago, and hadn't noticed that. I've either been very diligent with ensuring I never slipped-up with a trailing comma, or overlooked a special setting for that (the former would be a bit of a miracle).


I would recommend using a good javascript editor that shows trailing commas as errors (e.g. Aptana).

steffenk
20 Jul 2009, 6:25 AM
i lint my code to find extra commas. Is there any "plugin" eg for eclipse that does the lint?

(and i also mislike the trailing commas :) )