A model represents some data object in an application. For example you can have a model such as: Fruit, Car, Building, etc. in your application. Models are normally used by stores. Here is example how you would define a new model class. e.g.
Ext.define('MyApp.model.Person', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'surname', type: 'string'},
{name: 'age', type: 'int'}
],
getFullName: function() {
return this.get('name') + " " + this.get('surname');
}
});
After defining our model class we would possibly like to create an instance of it and probably call some methods. For example:
// Create person instance
var person = Ext.create('MyApp.model.Person', {
name : 'Jon',
surname: 'Doe',
age : 24
});
alert(person.getFullName()); // Display person full name