Html5移动开发论坛

注册

 

发新话题 回复该主题

sencha touch 复杂的model 接收值 问题 求 指教 跪谢.......... [复制链接]

1#
我的model



Ext.define("mobile.model.ProModelRecord", {
    extend: "Ext.data.Model",
    config:
      {   fields:[
             {name: "carId", type: "int" }, //ID
             {name: "logId", type: "int" },
             {name:"userName",type:"string"}
          ],
          belongsTo: 'mobile.model.ProModel'
      }
});
Ext.define("mobile.model.ProModel", {
    extend: "Ext.data.Model",
    id: "promodel",
    config:
      {
          fields:
            [
             {name: "carId", type: "int" }, //ID
             {name: "carTypeId", type: "string" },  
             {name: "carTypeName", type: "string" },
             {name: "carTypeImg", type: "string" },
             {name: "seatNo", type: "string"},
             {name: "carTypeLevel", type: "string"},
             { name: 'license',       type: 'string' },  
            { name: 'carStatus',       type: 'string' },  
            { name: 'carStatusName',       type: 'string' },
            { name: 'userId',       type: 'string' },
            ],
            hasMany: {//使用hasMany配置项,声明这个模型的数组类型字段。
                model: 'mobile.model.ProModelRecord',
                name: 'record'
            }
      }
});


我要接受的json 字符串


[{"carId":"1","carTypeId":"1","carTypeName":"奥迪A8","carTypeImg":"image/audia8.jpg","seatNo":"4","carTypeLevel":"1","license":"粤B4FY61","carStatus":"0","carStatusName":"空闲","record":[{"logId":"1","logType":"1","carId":"1","userName":"张永波","beginTime":"2013-10-28 09:00:00","endTime":"2013-10-28 09:00:00","actualEndTime":"2013-10-28 09:00:00","purpose":"null","destination":"null","handlingId":"null","handlingName":"null","status":"2","remark":"null"},{"logId":"2","logType":"1","carId":"1","userName":"张永波","beginTime":"2013-10-28 10:00:00","endTime":"2013-10-28 11:00:00","actualEndTime":"2013-10-28 11:00:00","purpose":"null","destination":"null","handlingId":"null","handlingName":"null","status":"2","remark":"null"}]},{"carId":"2","carTypeId":"2","carTypeName":"宾利","carTypeImg":"image/bingli.jpg","seatNo":"4","carTypeLevel":"2","license":"粤B*","carStatus":"0","carStatusName":"空闲","record":[]},{"carId":"3","carTypeId":"3","carTypeName":"宝马","carTypeImg":"image/baoma.jpg","seatNo":"6","carTypeLevel":"1","license":"粤B156UC","carStatus":"0","carStatusName":"空闲","record":[]},{"carId":"4","carTypeId":"4","carTypeName":"丰田埃尔法","carTypeImg":"image/fentian.jpg","seatNo":"5","carTypeLevel":"2","license":"粤B*","carStatus":"0","carStatusName":"空闲","record":[]},{"carId":"5","carTypeId":"5","carTypeName":"飞度","carTypeImg":"image/feidu.jpg","seatNo":"4","carTypeLevel":"1","license":"粤B9ND71","carStatus":"0","carStatusName":"空闲","record":[]}]
  

为何 其他的字段 都能有值   仅仅是 record 字段 值 为null 呢 :<
分享 转发
TOP
2#

这个要问你服务器那边的json了,为啥record是空的?

Sencha Touch 交流 QQ 群 224711028 欢迎您的加入。
PhoneGap安卓 交流 QQ 群 250395324欢迎您的加入。
Html5 APP 交流 QQ 群 273843464欢迎您的加入。
TOP
发新话题 回复该主题