extjs 多维数组支持
1. 使用继承(extend)
1 var model = Ext.define("Ext.data.reader.SomeModel", { 2 extend: 'Ext.data.Model', 3 fields: [ 4 {name: 'name'}, 5 {name: 'extra.gender'} 6 ], 7 get: function(field){ 8 if (field.indexOf('.') !== -1) { 9 var parts = field.split('.'); 10 var value = Ext.data.Model.prototype.get.call(this, parts[0]); 11 12 return Ext.isObject(value) ? value[parts[1]] : undefined; 13 } 14 return Ext.data.Model.prototype.get.call(this, field); 15 } 16 })
2. 使用映射(mapping)
{name: 'gender', mapping: 'extra.gender'}
参考:
1. http://stackoverflow.com/questions/8296507/extjs-4-grid-panel-how-to-use-dataindex-of-a-sub-element
2. http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.data.Field-cfg-mapping