I tried to use ExtJS with a JSON database but I keep getting the same error: ext-all.js Uncaught TypeError: Cannot call method 'getProxy' of undefined
.
My script is :
Ext.onReady(function(
var store=new Ext.data.Store(
reader=new Ext.data.JsonReader(
{name: 'name'},
{name: 'category' },
{name: 'address'},
{name: 'lat'},
{name: 'long'},
{name: 'tel'},
{name: 'opening'},
{name: 'closing'}),
proxy=new Ext.data.HttpProxy({
url : 'http://localhost/progetto/descrittore/json.php'}))
// method : 'GET'
})
In my HTML I included :
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="extjs/prova.js"></script>
What's causing this error, and how can I resolve it?
I tried to use ExtJS with a JSON database but I keep getting the same error: ext-all.js Uncaught TypeError: Cannot call method 'getProxy' of undefined
.
My script is :
Ext.onReady(function(
var store=new Ext.data.Store(
reader=new Ext.data.JsonReader(
{name: 'name'},
{name: 'category' },
{name: 'address'},
{name: 'lat'},
{name: 'long'},
{name: 'tel'},
{name: 'opening'},
{name: 'closing'}),
proxy=new Ext.data.HttpProxy({
url : 'http://localhost/progetto/descrittore/json.php'}))
// method : 'GET'
})
In my HTML I included :
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="extjs/prova.js"></script>
What's causing this error, and how can I resolve it?
Share Improve this question edited Jan 23, 2012 at 21:27 KatieK 13.9k19 gold badges78 silver badges91 bronze badges asked Jan 21, 2012 at 22:45 pilettoturtlepilettoturtle 731 silver badge5 bronze badges1 Answer
Reset to default 4From classes names I guess that you use Ext JS 3. Correct me if I am wrong.
The problem is that you don't follow the API. Store
constructor has following signature:
newExt.data.Store( Object config ) : Object
You should provide single config object. You pass reader and proxy instead.
Same story with Reader
. Signature is
newExt.data.JsonReader( Object meta, Array/Object recordType ) : Object
You should pass meta data and record definition as array. After correcting this, Ext don't throw exepctions any more. See code below.
Ext.onReady(function(){
var store=new Ext.data.Store({
reader: new Ext.data.JsonReader({}, [
{name: 'name'},
{name: 'category' },
{name: 'address'},
{name: 'lat'},
{name: 'long'},
{name: 'tel'},
{name: 'opening'},
{name: 'closing'}
]),
proxy: new Ext.data.HttpProxy({
url : 'http://localhost/progetto/descrittore/json.php'
})
});
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745493728a4630102.html
评论列表(0条)