O'Reilly logo

Learning Ext JS - Fourth Edition by Armando Gonzalez, Crysfel Villa, Carlos A. Méndez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Models

Models represent objects or entities inside our application, for example, Clients, Users, Invoices, and so on. Those models will be used by the data stores. We can define as many models as we need inside our application.

A model may contain fields, validations, and relationships between other models. We can also set a proxy to persist and pull our data.

Note

As of version 5.x, field definitions can be optional unless you need conversion, validations, or set an implicit data type. For more information, take a look at http://docs.sencha.com/extjs/5.1/whats_new/5.0/whats_new.html#Models.

To create a model, let's write the following code:

Ext.define('Myapp.model.Client',{
extend:'Ext.data.Model',  // step 1
idProperty:'clientId ', // step 2
fields:[ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required