PDA

View Full Version : data value field mapping



cracknuts
10 Jun 2014, 11:22 PM
I have an array store such as below:


var statusCodes = Ext.create('Ext.data.ArrayStore', {
fields: ['id', 'text'],
data: [
[0, 'Inactive'],
[1, 'Active'],
[2, 'Pending']
],


and I would like to mapped the id/text into 'status' field in my data model (below) to be used with gridpanel and formpanel without having to use 'renderer' or 'convert' method to mapped the 'status' code to its display string value. Any suggestion on how best to approach this problem would be much appreciated.


Ext.define('Currency.DataModel', {
extend: 'Ext.data.Model',
fields: ['code', 'name', 'desc', 'createdbyname', 'modifiedbyname',
{name: 'status', type: 'int'},
{name: 'createdby', type: 'int'},
{name: 'modifiedby', type: 'int'},
{name: 'createdon', type: 'date'},
{name: 'modifiedon', type: 'date'}
],
idProperty: 'id'
});

mitchellsimoens
26 Jun 2014, 6:15 AM
In your model, you would need to use a convert config in the field to join two different fields together into the one.