PDA

View Full Version : problems with grid example



tzander
22 Apr 2008, 1:33 AM
Hi

I have this:


var dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'sampledata-sheldon.xml'}),
reader: new Ext.data.XmlReader({
record: 'Item',
id: 'ASIN'
}, [
'Author', 'Title', 'Manufacturer', 'ProductGroup'
])
});

var colModel = new Ext.grid.ColumnModel([
{header: "Author", width: 120, dataIndex: 'Author'},
{header: "Title", width: 180, dataIndex: 'Title'},
{header: "Manufacturer", width: 115, dataIndex: 'Manufacturer'},
{header: "Product Group", width: 100, dataIndex: 'ProductGroup'}
]);



var grid = new Ext.grid.Grid('mygrid', {
ds: dataStore,
cm: colModel
});
assertEquals('dataStore', grid);
grid.render();

dataStore.load();

ext-all.js and ext-base.js is loaded the xml file is in the same dir.

and I get the error message:

Ext.grid.Grid is not a constructor

evant
22 Apr 2008, 1:35 AM
That looks like Ext1.x code.

If you're using the 2.x branch, that won't be correct.

tzander
22 Apr 2008, 1:41 AM
how would it look in ext 2.

Is there an example ?

Thanks

evant
22 Apr 2008, 1:45 AM
http://extjs.com/deploy/dev/examples/grid/xml-grid.js