I am trying to display data in an ExtJS grid. I have it mostly working, but in my array of data, I have an array containing additional data (named 'extra'). I need to display fields from this sub-array:
Here is some example data coming back from my server in to ExtJS (Direct proxy) - this is one record:
{"type":"rpc","tid":6,"action":"EncounterService","method":"getRecords","result":[{"id":"20","addedDate":"2011-09-22 11:02:04","clientID":"19","extra":{"gender":"M"}}]}
In my Ext.grid.Panel, I have a Store set that has a model that looks like this:
Ext.define('ESDB.model.Encounter', {
extend: 'Ext.data.Model',
fields: ['id','addedDate','clientID','extra']
});
Finally, my Ext.grid.panel, my columns are defined:
this.columns = [
{header: 'id', dataIndex: 'id', flex: 1}
{header: 'gender', dataIndex: 'extra.gender', flex: 1}
]
The id will display - as will any other field in the base 'result' array. However, I the 'extra.gender' does not work. How can I add a column and have it display the gender row from the 'extra' array object within my 'result' array object?