开发者社区> 问答> 正文

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 528 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
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
成功案例-Par...[幸运杰哥].1512720360.pdf 立即下载
数据展现:可视化...[jing.luojing].1477376058.pdf 立即下载
低代码开发师(初级)实战教程 立即下载