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

Extjs如何通过json接受后台传过来的String类型的List数据,求助
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({  url : "financial!listStudentsByPage.action"  }),
reader : new Ext.data.JsonReader({
        totalProperty : 'total',
                        root : 'listfinancial',
                        successProperty : 'SUCCESS',
                        fields : [{  }]

listfinancial在后台Action中定义private <String>List listfinancial;
listfinancial在后台已得到
fields 里面应该怎么填呢?
JSON Ext?JS String

------解决方案--------------------
list里面封装的是啥?
如果是一个个object,那么可以不用配置root和successProperty,直接可以在fields里配置obj的字段名即可,
fields:[{name:'name'},{name:'value'}]
如果是这种类似的二维数组结构[['huawei',001,'cellphone'],['bv',002,'inspection'],....]
更好办了,extjs的grid例子里,差不多全都是这样的数据结构,相信撸主一定能很快学会的。
good luck.
------解决方案--------------------
如果你说的事这种["huawei","123","cellphone"];
那就不知道怎么配置了,fields貌似不支持这种。
一般extjs接收的格式要么是json格式,要么是类似二维数组格式。