PDA

View Full Version : How to define Array Field in Ext Model



tonyx
17 Aug 2011, 8:38 AM
I'm trying to figure out, how do I define my model so that I have an array of integers as one of the fields, such as




Ext.define('My.model.MyModelt', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'int'},
{ name: 'name', type: 'string'},
{ name: 'description', type: 'string'},
{ name: 'tag_ids", type: 'array_of_int' }
]
});

stevil
17 Aug 2011, 11:35 AM
Try




Ext.define('My.model.MyModelt', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'int'},
{ name: 'name', type: 'string'},
{ name: 'description', type: 'string'},
{ name: 'tag_ids", type: 'auto' }
]
});


This should cause the model to leave it alone if it can't figure it out - the same would be true for a field that was actually a compound object.

stevil

tonyx
17 Aug 2011, 1:03 PM
Works perfect. Thank you!