Anyone know how you model subfields of any field in ExtJS? For example
Ext.data.Model:
fields:[
{name: 'id', type: 'int'},
{name: 'title', type: 'string'},
{name: 'description', type: 'string'},
{name: 'priority', type: 'auto', fields:[
{name: 'code', type: 'string'}
]},
{name: 'createdBy', type: 'auto'},
]
then in my grid panel
Ext.grid.Panel
columns:[
{header:'Title', dataIndex:'title', flex:1},
{header:'Priority', dataIndex:'code'}
],
Any idea how I access the dataIndex 'code' under 'priority'? thanks in advance!
Thanks to @sha - here is the answer I needed :)
Model
fields:[
{name: 'id', type: 'int'},
{name: 'title', type: 'string'},
{name: 'description', type: 'string'},
{name: 'priority', type: 'auto'},
{name: 'code', type: 'string', mapping:'priority.code'},
{name: 'createdBy', type: 'auto'},
]
Gird Panel
columns:[
{header:'Title', dataIndex:'title', flex:1},
{header:'Description', dataIndex:'description'},
{header:'Priority', dataIndex:'code'}
],
Try this:
dataIndex: 'priority.code'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With