PDA

View Full Version : Grid Example (Tutorial:Introduction to Ext 2.0)



dexter
20 Jan 2009, 4:14 PM
Good Day

I am trying to get the Grid Example per "Tutorial:Introduction to Ext 2.0" to work. However, I am running into a "null is null or not an object" error.

Any help would be really appreciated. Thanks.

mjlecomte
20 Jan 2009, 6:35 PM
Sounds like an IE error. Did you try with firefox/firebug?

TriangleIL
20 Jan 2009, 8:40 PM
When I started out I got the same issue, unfortunately I can't remember exactly why it was. If you post your code I'd be happy to try and assist.

Jason

dexter
21 Jan 2009, 8:47 AM
I tinkered around some more and discovered that a set of other Java Scripts that are included in my HTML page may be causing a conflict with ExtJs. Namely, the Java Scripts that come from fvalidate and jscalendar.

I comment out the include statements for these scripts and things seem to work for ExtJs. I'm puzzled, however, as to what is causing the problem.

The code I am using is listed below. It is copied directly from Ext documentation.



Ext.onReady(function() {
var myData = [
['Apple',29.89,0.24,0.81,'9/1 12:00am'],
['Ext',83.81,0.28,0.34,'9/12 12:00am'],
['Google',71.72,0.02,0.03,'10/1 12:00am'],
['Microsoft',52.55,0.01,0.02,'7/4 12:00am'],
['Yahoo!',29.01,0.42,1.47,'5/22 12:00am']
];
var myReader = new Ext.data.ArrayReader({}, [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
]);
var grid = new Ext.grid.GridPanel({
store: new Ext.data.Store({
data: myData,
reader: myReader
}),
columns: [
{header: 'Company', width: 120, sortable: true, dataIndex: 'company'},
{header: 'Price', width: 90, sortable: true, dataIndex: 'price'},
{header: 'Change', width: 90, sortable: true, dataIndex: 'change'},
{header: '% Change', width: 90, sortable: true, dataIndex: 'pctChange'},
{header: 'Last Updated', width: 120, sortable: true,
renderer: Ext.util.Format.dateRenderer('m/d/Y'),
dataIndex: 'lastChange'}
],
viewConfig: {
forceFit: true
},
title: 'My First Grid',
width: 500,
renderTo: 'content',
autoHeight: true,
frame: true
});
grid.getSelectionModel().selectFirstRow();
});
Ext.onReady(function(){

});

dexter
21 Jan 2009, 8:50 AM
Sounds like an IE error. Did you try with firefox/firebug?

Thanks; I used Firefox and Firebug. That's what pointed out one of the jscalendar scripts.