PDA

View Full Version : Model -> Convenience Methods



Bleak
7 Mar 2014, 8:15 AM
If I have a model defined as



Ext.define('AppConfig.model.User', {
extend : 'Ext.data.Model',
fields : [
{ name : 'id',type : 'integer' },
{ name : 'description', type : 'string' }
]
});


Will the framework automatically add the methods getId(), getDescription()?

I do not see these in my code, but wondering if it is possible I am missing something that would create them.

mitchellsimoens
7 Mar 2014, 8:23 AM
No, you have to use the get method:


record.get('description')

Ext.data.Model does have a getId method defined but it's not created from the field, it's defined as a class method.

Bleak
7 Mar 2014, 8:34 AM
Thanks, appreciate the quick response.