Ext.define('User', {
extend: 'Ext.data.Model',
proxy: {
type: 'memory',
reader: {
type: 'json'
}
},
fields: [
{mapping: 'ErrorCode', name: 'name', type: 'string'},
{name: 'age', type: 'int', convert: null},
{name: 'phone', type: 'string'},
{name: 'alive', type: 'boolean', defaultValue: true, convert: null}
]
});
var usr = Ext.create('User', {
ErrorCode: 'test string'
});
console.log(
// expected "test string"
usr.get('name')
)
песочница
https://fiddle.sencha.com/#view/editor&fiddle/283k