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?
From 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.
Storeconstructor has following signature:newExt.data.Store( Object config ) : ObjectYou should provide single config object. You pass reader and proxy instead.
Same story with
Reader. Signature isnewExt.data.JsonReader( Object meta, Array/Object recordType ) : ObjectYou should pass meta data and record definition as array. After correcting this, Ext don’t throw exepctions any more. See code below.