2012-01-21 7 views
0

JSONデータベースでExtJSを使用しようとしましたが、同じエラーが発生し続けます:ext-all.js Uncaught TypeError: Cannot call method 'getProxy' of undefinedエラー 'ext-all.jsを解決する方法Uncaught TypeError:未定義の' getProxy 'メソッドを呼び出せませんか?

私のスクリプトは次のとおりです。私のHTMLで

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' 
      }) 

私が含ま:

<script type="text/javascript" src="extjs/ext-all.js"></script> 
<script type="text/javascript" src="extjs/prova.js"></script> 

をこのエラーを引き起こし、そしてどのように私はそれを解決することができますか?

答えて

4

クラス名からは、Ext JS 3を使用していると思います。間違っていると私を修正してください。

問題は、APIに従わないことです。 Storeコンストラクタは、署名を以下ました:

newExt.data.Store(Object config) : Object

をあなたは単一 configオブジェクトを提供する必要があります。代わりにリーダーとプロキシを渡します。 同じ話はReaderです。署名は、あなたが配列としてメタデータとレコード定義を渡す必要があり

newExt.data.JsonReader(Object meta, Array/Object recordType) : Object

です。これを修正した後、Extはもうexectionsを投げません。以下のコードを参照してください。

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' 
     }) 
    }); 
}); 
+0

私の現在の問題で私は助けられました。ありがとう、あなたのために+1! –