2011-10-19 13 views
0

JSONストアからEXTグリッドにデータを読み込む際に問題が発生しました。され、次のコード:それはサーバーにリクエストを送信し、データが返送されますが、グリッドが:(取り込まれることはありませんようJSONStoreからextJSグリッドにデータをロードするには?

var store = new Ext.data.JsonStore({ 
     root: 'rates', 
     autoLoad=true, 
     fields: ['mainid','Country'], 
     proxy : new Ext.data.HttpProxy({ 
       method: 'GET', 
       url: '/projectLink/gridData.php' 
      }) 
    }); 

    var grid = Ext.create('Ext.grid.Panel',{ 
        renderTo: 'grid-rates', 
        width:700, 
        height:500, 
        title:"Country", 
        store:store, 
        columns:[ 
           {id: 'mainid', header: "mainid", width: 200, sortable: true, dataIndex: 'mainid'}, 
           {id: 'Country', header: "Country", width: 200, sortable: true, dataIndex: 'Country'} 
          ] 

       }); 

JSONストアがいっぱいなっている何が欠けてい

を私は「JSON後?使用してメートル:!

{"count":"18239", 
"rates":[ 
{"mainid":"75966","Country":"Afghanistan Cellular-AT"}, 
{"mainid":"75967","Country":"Afghanistan Cellular-AWCC"}, 
{"mainid":"75968","Country":"Afghanistan Cellular-Areeba"}, 
{"mainid":"75969","Country":"Afghanistan Cellular-Etisalat"}, 
{"mainid":"75970","Country":"Afghanistan Cellular-Others"}, 
{"mainid":"75971","Country":"Afghanistan Cellular-Roshan"}, 
{"mainid":"75972","Country":"Albania"}, 
{"mainid":"75973","Country":"Albania Cellular-AMC"}, 
{"mainid":"75974","Country":"Albania Cellular-Eagle"}, 
{"mainid":"75975","Country":"Albania Cellular-Plus"} 
]} 

も4.0.2a
でテスト

+0

は、あなたが取得しているいずれかのエラーがありますか?エラーメッセージがあれば投稿してください。 – netemp

答えて

2

使用Ext.data.Store代わりJsonStoreを、助けてください私はこれが問題であるかどうかわからないんだけど、設定autoLoadが間違っている

var store = new Ext.data.Store({ 
    fields:['mainid','Country'], 
    proxy: { 
     type: 'ajax', 
     url : '/projectLink/gridData.php', 
     reader: { 
      type: 'json', 
      root: 'rates', 
      totalProperty : "count" 
     } 
    }, 
    autoLoad : true 
}); 
2

:私はこれを試してドキュメント

でJsonStoreを見つけることができません。

あなたが持っている:autoLoad=true

をそれは次のようになります。autoLoad : true

関連する問題