后端返回的数据是{"id":"1100","channel":"1","title":"网络信息","user":{"counterno":"100000000","email":"admin@qq.com"}}
{field:'title',title:'标题',width:120,sortable:true},
{field:'user',title:'用户姓名',width:120,sortable:true,
formatter:function(value,row,index){
return value.email;
}
}
这种方式可以显示出来,但是问题是只能用一次,因为field:'user' 这个不能重复,要显示子属性所有的字段有没什么其他办法,尝试写法{field:'user.email',title:'标题',width:120,sortable:true} 这种写法是不行的。
返回的数据扁平化不就可以了吗,不嵌套{"id":"1100","channel":"1","title":"网络信息","counterno":"100000000","email":"admin@qq.com"}
filed不支持点号配置,就是数据为{"xx":{"bb":"xx"},"CC":"cc"...}时,filed不能配置为"xx.bb",无效,配置formatter来返回嵌套的数据
formatter:function(value){return value.bb}