0

我有一个像这样的 jsonStore

var ch01_store = new Ext.data.JsonStore({
        autoLoad:true,

        storeId: 'ch01_store',
        proxy: new Ext.data.HttpProxy({
            url: 'index.php/test/get_ch01/10',
            method: 'POST'
        }),
        root: 'data',
        totalProperty: 'results',
        remoteSort: true,
        fields: [
            {name: 'date_time', mapping: 'date_time'},
            {name: 'chart_data', mapping: 'chart_data'}
        ]
    });

并且“localhost/myweb/index.php/test/get_ch01/10” url 在页面上产生了这个

   {
   "success": true,
   "results": 10,
   "data": [{
         "date_time": "5/12/2012 13:13:33",
         "chart_data": "3.5"
      },
      {
         "date_time": "5/12/2012 13:13:34",
         "chart_data": "0.0"
      },
      {
         "date_time": "5/12/2012 13:13:35",
         "chart_data": "3.5"
      },
      {
         "date_time": "5/12/2012 13:13:36",
         "chart_data": "0.0"
      },
      {
         "date_time": "5/12/2012 13:13:4",
         "chart_data": "0.0"
      },
      {
         "date_time": "5/12/2012 13:13:5",
         "chart_data": "3.5"
      },
      {
         "date_time": "5/12/2012 13:13:6",
         "chart_data": "0.0"
      },
      {
         "date_time": "5/12/2012 13:13:7",
         "chart_data": "3.5"
      },
      {
         "date_time": "5/12/2012 13:13:8",
         "chart_data": "0.0"
      },
      {
         "date_time": "5/12/2012 13:13:9",
         "chart_data": "3.5"
      }
   ]
}

但是当我执行时

console.log(ch01_store.getCount()); 

日志显示为零,我试图将它填充到 gridPanel 上,结果仍然是空的,有人可以帮我吗?

4

1 回答 1

0

像这样设置代理并尝试:

proxy: {
    type: 'ajax',
    reader: {
        type: 'json',
        root: 'xxxxxx'
        }
}
于 2012-05-13T20:50:18.213 回答