PDA

View Full Version : problem with datastore



SauronTNT
1 Oct 2009, 12:01 AM
Hello,

i am newby with EXTJs. I have a strange error with sample of the Api DOC.

I write my script :



Ext.onReady(function(){

// sample static data for the store
var myData = [
['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
];

// create the data store

var store = new Ext.data.ArrayStore({
// store configs
autoDestroy: true,
storeId: 'myStore',
// reader configs
idIndex: 0,
fields: [
'company',
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
]
});

// manually load local data
store.loadData(myData);

});
My html is :



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Stateful Array Grid Example</title>

<!-- ** CSS ** -->
<!-- base library -->
<link rel="stylesheet" type="text/css" href="./resources/css/ext-all.css" />

<!-- overrides to base library -->

<!-- page specific -->

<!-- ** Javascript ** -->
<!-- ExtJS library: base/adapter -->
<script type="text/javascript" src="./adapter/ext/ext-base.js"></script>

<!-- ExtJS library: all widgets -->
<script type="text/javascript" src="./ext-all.js"></script>

<script type="text/javascript" src="./mainscript.js"></script>

</head>

<body>
<h1>Stateful Array Grid Example</h1>
<p>This example shows how to create a grid from Array data.</p>
<p>The grid is stateful so you can move or hide columns, reload the page, and come
back to the grid in the same state you left it in.</p>
<p>Note that the js is not minified so it is readable. See <a href="array-grid.js">array-grid.js</a>.</p>

<div id="grid-example"></div>

</body>
</html>
and I receive this error in firebug :



Ext.data.ArrayStore is not a constructor
http://localhost/Layout/mainscript.js
Line 29
Can you say me what i do wrong ?

rblon
1 Oct 2009, 12:18 AM
are you sure the relative paths are correct?



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


I have tried your code with my settings and it works.

SauronTNT
1 Oct 2009, 3:08 AM
yes all path are correct, i have checked :(

jay@moduscreate.com
1 Oct 2009, 3:10 AM
Check with firebug, are the scripts being served up?

SauronTNT
1 Oct 2009, 4:56 AM
I have found the issue :)

it was not the relative path, for my example i have use a old version of the library ext-all.js I-|

Now I use the last one and it work.

Thanks for your help