I want to add the associations on model based on the value of a field. For example:
I want to add associations like
Parent Model:
Ext.define('App.model.parentModel', {
extend: 'Ext.data.Model',
requires: [
'App.model.ChildModel1',
'App.model.ChildModel2',
],
idProperty: 'type',
fields: [
'name',
'type'
],
proxy:[//proxy]
});
I want to add associations like
hasMany:{
model:'App.model.ChildModel1'
}
if my value for 'type' field is automobile.
Else I want to add associations like
hasMany:{
model:'App.model.ChildModel2'
}
How can I check this on fly and add associations?