Extjs - Multi level json for grid
{ "root" : [ {
"affiliateId" : 8,
"name" : "Affiliate Name",
"email" : "affiliate@gmail.co.il",
"manager" : {
"name" : "I am the manager",
"email" : "manager@gmail.co.il"
},
} ],
"totalCount" : 1
}
now, when I build the grid fields I want to use the deeper items, for example:
{
name:'manager_email',
开发者_如何学Python header: "Manager",
dataIndex: 'manager.email',/******access a deep level******/
width: 100,
sortable: true,
type:'text'
}
I get no error, just empty cell in the grid.
Thanks
You should look into the mapping
config option - define your field like this:
{
name:'manager_email',
header: 'Manager',
mapping:'manager.email'
...
}
Another option might be to use a renderer
this way:
{
name:'manager_email',
header: 'Manager',
dataIndex: 'manager'
renderer : function(value,metadata,record){
return record.data.manager.email;
}
...
}
精彩评论