1. 程式人生 > >EXTJS 4 Json nested data in grid panel

EXTJS 4 Json nested data in grid panel

{
  "success":true,
  "error":false,
  "redirectUrl":null,
  "fund":[{
    "cat_id":1,
    "catname":"Europe OE Japan Large-Cap Equity",
    "region":{
      "region_id":2,
      "region_name":"JAPAN"
    }
    },{
    "cat_id":2,
    "catname":"Europe OE Europe Large-Cap Growth Equity",
    "region"
:{ "region_id":1, "region_name":"EUROPE" } }]

}

Ext.define('Fund', {
    extend: 'Ext.data.Model',
    fields: [
      { name: 'catname',     type: 'string' },     
      { name: 'cat_id',      type: 'int' },
      { name: 'region_name', type: 'string',
          mapping:
'region.region_name'}, { name: 'region_id', type: 'int', mapping: 'region.region_id'} ] });

copy from http://stackoverflow.com/questions/11562604/extjs-4-json-nested-data-in-grid-panel