O'Reilly logo

Learning Ext JS 4 by Armando Gonzalez, Crysfel Villa

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

A model is a representation of the information in our application domain. We define objects that hold our data, so we can easily access performance specific tasks such as writing and reading. We can define as many models as we need. Each model represents an entity such as User, Invoice, Client, or whatever we need in our project.

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

Let's create a new file located at js/MyApp/model and we will call it Invoice.js. In this file we're going to create our Invoice class as follows:

Ext.define('MyApp.model.Invoice',{ extend : 'Ext.data.Model', // Step 1 idProperty : 'idInvoice',//Step 2 fields : [ // Step 3 {name:'IdInvoice'}, ...

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