A particular request to my server returns x fields of JSON. I want to combine several of these fields and insert the concatenated data into the x+1 field of my JsonStore.
I know how to process the load event, read each record, concatenate the appropriate fields, and insert into my x+1st field. However, is there a better (more efficient) way to accom开发者_开发技巧plish this - perhaps by overriding JsonReader?
You are looking for Ext.data.Field.convert
Reference - ExtJS 3.x / ExtJS 4.x
Example using 4.x version -
....
fields: [
'name', 'email',
{name: 'age', type: 'int'},
{name: 'gender', type: 'string', defaultValue: 'Unknown'},
{
name: 'whatever',
convert: function(value, record) {
return record.get('f1') + record.get('a2'),
}
}
]
....
精彩评论