Ext


Go Back   Ext JS Forums > Ext JS Community Forums (1.x) [Unsupported] > Ext 1.x: Help

Reply
 
Thread Tools
  #1  
Old 10-03-2007, 09:28 AM
sixtoedsloth sixtoedsloth is offline
Ext User
 
Join Date: May 2007
Posts: 23
sixtoedsloth is on a distinguished road
Question RESOLVED - Starter Example

Just so some people dont suffer the same as me

the (enlightening and very good ) The Introduction Page to Ext does not work with new Ext 2.0 Alpha release (as it currently stands).

Hi All - Noob here

This may seem a bit pathetic, with an easy answer no doubt, but it is doing my head in

I was following the examples given at The Introduction Page. The paragraph example and AJAX worked just fine but i couldnt get the grid example to work.

I ran it under Firebug and i got an error saying 'Ext.grid.Grid is not a constructor'.

Am i missing some include file or something? There is no mention in the write-up that there should be any other files included. It suggests it should run as-is and i followed the instructions to the letter AFAIK.

my html file contains these includes

    <script type="text/javascript" src="../adapter/yui/yui-utilities.js"></script>
    <script type="text/javascript" src="../adapter/yui/ext-yui-adapter.js"></script>
    <script type="text/javascript" src="../ext-all.js"></script>
    <script type="text/javascript" src="grid.js"></script>
....

<div id="grid-example" style="overflow: hidden; width: 535px; height: 125px;border:2px solid #999;margin:20px 50px;visibility:hidden;"></div>
where grid.js contains the user code.

the grid.js (basically copied from the page) contains

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 ds = new Ext.data.Store({
		proxy: new Ext.data.MemoryProxy(myData),
		reader: new Ext.data.ArrayReader({id: 0}, [
			{name: 'company'},
			{name: 'price', type: 'float'},
			{name: 'change', type: 'float'},
			{name: 'pctChange', type: 'float'},
			{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
		])
	});
	ds.load();

	var colModel = new Ext.grid.ColumnModel([
		{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'}
	]);

	var grid = new Ext.grid.Grid('grid-example', {ds: ds, cm: colModel}); //  <------stumbles here
	grid.render();
	grid.getSelectionModel().selectFirstRow();
});
and it wont generate the code and stumbles at line shown above. I tried it with other grid examples and the same error occurred.

Please make a tired man happy

Thx In advance

Alex
Reply With Quote
  #2  
Old 10-03-2007, 09:43 AM
sj137 sj137 is offline
Ext User
 
Join Date: Apr 2007
Location: Italy/UK
Posts: 138
sj137 is on a distinguished road
Default

just a suggestion...

try calling ds.load() after grid.render()...
Reply With Quote
  #3  
Old 10-03-2007, 09:45 AM
fay fay is offline
Ext User
 
Join Date: Apr 2007
Location: Ireland
Posts: 807
fay is on a distinguished road
Default

Methinks you are trying out ExtJS 1.x examples with ExtJS 2.0 source. Download and experiment with 1.1.1 as 2.0 is still an Alpha release.
Reply With Quote
  #4  
Old 10-03-2007, 10:01 AM
sixtoedsloth sixtoedsloth is offline
Ext User
 
Join Date: May 2007
Posts: 23
sixtoedsloth is on a distinguished road
Default RESOLVED

Thanx Fay that is the answer

the example page does not work with new Ext Alpha release.

Downloaded 1.1 and worked just fine

thx

Alex
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 11:11 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.