开发者社区> 问答> 正文

Extjs JsonStore data 赋值问题,在线等? 400 报错

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 赋值的时候出错,向大家请教,谢谢

展开
收起
爱吃鱼的程序员 2020-06-04 15:18:54 526 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    没有人回答吗?

    ######

    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得设置读取的字段 

    2020-06-04 15:57:26
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
编程语言如何演化—— 以 JS 的 private 为例 立即下载
编程语言如何演化-以JS的private为例 立即下载
探究 Node.js 的服务端之路 立即下载