最近做EXTJS4 的 东西 遇到了问题 想求教 大家:
对嵌入对象做了mapping 可是 取不到 请朋友们指点:
后台发送过来的json 数据
{"totalRecord":26,"employees":{
"id":1,
"dept":{"name":"咨询部",id":3,"description":null,"code":null}
,"user":null,
"title":{"name":"咨询","id":3}
}
}
store:
this.store = Ext.create('Ext.data.Store', {
fields: ['id',{name:'deptName',mapping:'dept.name'},
{name:'titleName',mapping:'title.name'}, ],
pageSize:20,
proxy: {
type: 'ajax',
actionMethods : 'post',
url : "aa/aaa",
timeout : 1000*60*3,
reader: {
totalProperty:'totalRecord',
type: 'json',
root: 'employees',
remoteSort: true
}
}
});
grid 中的对应列
this.columns =[
{xtype: 'rownumberer',width: 50, sortable: false,align:'center'},
{header: '部门', dataIndex: 'deptName',width:150},
{header: '职位', dataIndex: 'titleName',width:150}
],
fireBug 报出的错误obj.dept is null
请问 这个 store 的 fields 应该怎么写?
请问 这个 store 的 fields 应该怎么写?