Extjs JsonStore data 赋值问题,在线等? 400 报错
var myData = new Ext.data.Store({
autoLoad:true,
baseParams :{
cmd: 'project',
action: 'searchMumbers',
start: 0,
limit: 5
},
proxy: new Ext.data.HttpProxy({
url:URL
}),
reader: new Ext.data.JsonReader({
root:'record',
id: 'id',
totalProperty: 'totalRecords',
idProperty:'id',
fields:fields
})
});
myData.on('load',function(tempstore){alert(Ext.util.JSON.encode(myData.getAt(0).data));});可以弹出数据 {"mumbername":"mumber1","mumberdept":"0001"}
后台返回的数据:
头信息Post响应JSON
{'result':'success', 'totalRecords': 11,record:[{"mumbername":"mumber1","mumberdept":"0001","mumberid":1},{"mumbername":"mumber2","mumberdept":"0002","mumberid":2},{"mumbername":"mumber3","mumberdept":"0003","mumberid":3},{"mumbername":"mumber4","mumberdept":"0004","mumberid":4},{"mumbername":"mumber5","mumberdept":"0005","mumberid":5}]}
var firstGridStore = new Ext.data.JsonStore({
fields : fields,
data : myData,
root : 'record'
});
但是在data 赋值的时候出错,向大家请教,谢谢
没有人回答吗?
######var myData = [{'result':'success', 'totalRecords': 11,record:[{"mumbername":"mumber1","mumberdept":"0001","mumberid":1}]];
var firstGridStore = new Ext.data.JsonStore({
fields : ['mumbername','mumberdept',{'mumberid',type:int}],
data : myData,
root : 'record'
});
fields得设置读取的字段
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。