PDA

View Full Version : Extend from custom model class in ExtJS 4



nas.sencha
13 Oct 2012, 2:43 PM
How to extend from custom model in extjs.
Is there any method which can directly club the fields of User and BusinessUser fields when I'll refer the fields from BusinessUser class in example below.

Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'age', type: 'int'},
{name: 'phone', type: 'string'},
{name: 'alive', type: 'boolean', defaultValue: true}
],
});

Ext.define('BusinessUser', {
extend: 'User',
fields: [
{name: 'businessType', type: 'string'},
{name: 'company', type: 'string'}
],
});

vietits
13 Oct 2012, 3:09 PM
Not sure what you need. However, with your code BusinessUser will have all fields from User and two fields defined for its own.

nas.sencha
14 Oct 2012, 9:41 AM
Got this answered at
http://stackoverflow.com/questions/12877565/extend-from-custom-model-class-in-extjs-4