Creating models
Let's start with understanding how we can represent a data structure by using a model and create objects using it.
Getting ready
Make sure that you have set up your development environment by following the recipes outlined in Chapter 1, Gear up for the Journey.
Create a new folder named ch05
in the same folder where we created the ch01
and ch02
folders. We will be using this new folder in which to keep the code.
How to do it...
Carry out the following steps:
- Create and open a new file named
ch05_01.js
and paste the following code into it:Ext.setup({ onReady: function() { Ext.regModel('User', { fields: [ {name: 'name', type: 'string'}, {name: 'age', type: 'int'}, {name: 'phone', type: 'string'}, {name: 'email', type: 'string'}, {name: ...
Get Sencha Touch Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.