日期:2014-05-16  浏览次数:20320 次

extjs4.2中 Store获取后台服务端数据失败
上代码

var _store = Ext.create('Ext.data.ArrayStore', {
        autoLoad:true,
        fields: [
                'Text', 'Value'
        ],
        proxy: {
            url: "Handler/StoreBind.ashx",
            type: 'ajax',
        }
    })


后台代码和返回值如下
用的Newtonsoft.Json.Linq处理json数据

  while (dReader.Read())
  {
      _jarray.Add(new JObject(
       new JProperty("Value", dReader["Value"]),
       new JProperty("Text", dReader["Text"])
       ));
  }
  context.Response.Write(_jarray.ToString());

返回值
[
  {
    "Value": "B23042450529",
    "Text": "B23042450529"
  },
  {
    "Value": "C23042450562",
    "Text": "C23042450562"
  },
  {
    "Value": "C23042450847",
    "Text": "C23042450847"
  }
]

执行完后我设置断点测试_store.getCount()为0,没抓到后台数据有人知道下么,API网上资料都查找了半天木有找到解决方法
extjs4 JavaScript

------解决方案--------------------
proxy: {
        type: 'ajax',
        url: '/',
        reader: {
            type: 'json'
        }
    }