Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.data.Model.html
1 <!DOCTYPE html><html><head><title>Ext.data.Model | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
2 <style type="text/css">.head-band { display: none; }
3 .header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
4 .doc-tab .members .member a.more { background-color: #efefef; }
5 </style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
6 </head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
7 <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
8
9     req = {
10         liveURL: '.',
11         standAloneMode: true,
12         origDocClass: 'Ext.data.Model',
13         docClass: 'Ext.data.Model',
14         docReq: 'Ext.data.Model',
15         version: '4.0',
16         baseURL: '.',
17         baseDocURL: '.',
18         baseProdURL: '.'
19     };
20
21     clsInfo = {};
22
23
24
25 </script>
26
27 <script type="text/javascript" src="../search.js"></script>
28 <!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
29 <script type="text/javascript" src="../class_tree.js"></script>
30 <script type="text/javascript" src="../class_doc.js"></script>
31 <script type="text/javascript">
32     req.source = 'Model.html#Ext-data.Model';
33     clsInfo = {"methods":["Model","addEvents","addListener","addManagedListener","beginEdit","cancelEdit","capture","clearListeners","clearManagedListeners","commit","copy","destroy","enableBubble","endEdit","fireEvent","get","getAssociatedData","getChanges","getId","getProxy","hasListener","id","isModified","isValid","join","load","observe","on","reject","relayEvents","releaseCapture","removeListener","removeManagedListener","resumeEvents","save","set","setDirty","setId","setProxy","suspendEvents","un","unjoin","validate"],"cfgs":["idProperty","listeners","persistanceProperty"],"properties":["defaultProxyType","dirty","editing","fields","modified","phantom","store"],"events":[],"subclasses":["Ext.grid.property.Property"]};
34     Ext.onReady(function() {
35         Ext.create('Docs.classPanel');
36     });
37 </script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Model.html#Ext-data.Model" target="_blank">Ext.data.Model</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><pre class="subclasses"><h4>Mixins</h4><div class="mixin"><a href="Ext.util.Observable.html" rel="Ext.util.Observable" class="cls docClass">Ext.util.Observable</a></div></pre><p>A Model represents some object that your application manages. For example, one might define a Model for Users, Products,
38 Cars, or any other real-world object that we want to model in the system. Models are registered via the <a href="Ext.ModelManager.html" rel="Ext.ModelManager" class="docClass">model manager</a>,
39 and are used by <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">stores</a>, which are in turn used by many of the data-bound components in Ext.</p>
40
41
42
43
44 <p>Models are defined as a set of fields and any arbitrary methods and properties relevant to the model. For example:</p>
45
46
47
48
49 <pre class="prettyprint"><code>Ext.define('User', {
50     extend: 'Ext.data.Model',
51     fields: [
52         {name: 'name',  type: 'string'},
53         {name: 'age',   type: 'int'},
54         {name: 'phone', type: 'string'},
55         {name: 'alive', type: 'boolean', defaultValue: true}
56     ],
57
58     changeName: function() {
59         var oldName = this.get('name'),
60             newName = oldName + " The Barbarian";
61
62         this.set('name', newName);
63     }
64 });
65 </code></pre>
66
67
68
69
70 <p>The fields array is turned into a <a href="Ext.util.MixedCollection.html" rel="Ext.util.MixedCollection" class="docClass">MixedCollection</a> automatically by the <a href="Ext.ModelManager.html" rel="Ext.ModelManager" class="docClass">ModelManager</a>, and all
71 other functions and properties are copied to the new Model's prototype.</p>
72
73
74
75
76 <p>Now we can create instances of our User model and call any model logic we defined:</p>
77
78
79
80
81 <pre class="prettyprint"><code>var user = Ext.ModelManager.create({
82     name : 'Conan',
83     age  : 24,
84     phone: '555-555-5555'
85 }, 'User');
86
87 user.changeName();
88 user.get('name'); //returns "Conan The Barbarian"
89 </code></pre>
90
91
92
93
94 <p><u>Validations</u></p>
95
96
97
98
99 <p>Models have built-in support for validations, which are executed against the validator functions in
100 <a href="Ext.data.validations.html" rel="Ext.data.validations" class="docClass">Ext.data.validations</a> (<a href="Ext.data.validations.html" rel="Ext.data.validations" class="docClass">see all validation functions</a>). Validations are easy to add to models:</p>
101
102
103
104
105 <pre class="prettyprint"><code>Ext.define('User', {
106     extend: 'Ext.data.Model',
107     fields: [
108         {name: 'name',     type: 'string'},
109         {name: 'age',      type: 'int'},
110         {name: 'phone',    type: 'string'},
111         {name: 'gender',   type: 'string'},
112         {name: 'username', type: 'string'},
113         {name: 'alive',    type: 'boolean', defaultValue: true}
114     ],
115
116     validations: [
117         {type: 'presence',  field: 'age'},
118         {type: 'length',    field: 'name',     min: 2},
119         {type: 'inclusion', field: 'gender',   list: ['Male', 'Female']},
120         {type: 'exclusion', field: 'username', list: ['Admin', 'Operator']},
121         {type: 'format',    field: 'username', matcher: /([a-z]+)[0-9]{2,3}/}
122     ]
123 });
124 </code></pre>
125
126
127
128
129 <p>The validations can be run by simply calling the <a href="Ext.data.Model.html#validate" rel="Ext.data.Model#validate" class="docClass">validate</a> function, which returns a <a href="Ext.data.Errors.html" rel="Ext.data.Errors" class="docClass">Ext.data.Errors</a>
130 object:</p>
131
132
133
134
135 <pre class="prettyprint"><code>var instance = Ext.ModelManager.create({
136     name: 'Ed',
137     gender: 'Male',
138     username: 'edspencer'
139 }, 'User');
140
141 var errors = instance.validate();
142 </code></pre>
143
144
145
146
147 <p><u>Associations</u></p>
148
149
150
151
152 <p>Models can have associations with other Models via <a href="Ext.data.BelongsToAssociation.html" rel="Ext.data.BelongsToAssociation" class="docClass">belongsTo</a> and
153 <a href="Ext.data.HasManyAssociation.html" rel="Ext.data.HasManyAssociation" class="docClass">hasMany</a> associations. For example, let's say we're writing a blog administration
154 application which deals with Users, Posts and Comments. We can express the relationships between these models like this:</p>
155
156
157
158
159 <pre class="prettyprint"><code>Ext.define('Post', {
160     extend: 'Ext.data.Model',
161     fields: ['id', 'user_id'],
162
163     belongsTo: 'User',
164     hasMany  : {model: 'Comment', name: 'comments'}
165 });
166
167 Ext.define('Comment', {
168     extend: 'Ext.data.Model',
169     fields: ['id', 'user_id', 'post_id'],
170
171     belongsTo: 'Post'
172 });
173
174 Ext.define('User', {
175     extend: 'Ext.data.Model',
176     fields: ['id'],
177
178     hasMany: [
179         'Post',
180         {model: 'Comment', name: 'comments'}
181     ]
182 });
183 </code></pre>
184
185
186
187
188 <p>See the docs for <a href="Ext.data.BelongsToAssociation.html" rel="Ext.data.BelongsToAssociation" class="docClass">Ext.data.BelongsToAssociation</a> and <a href="Ext.data.HasManyAssociation.html" rel="Ext.data.HasManyAssociation" class="docClass">Ext.data.HasManyAssociation</a> for details on the usage
189 and configuration of associations. Note that associations can also be specified like this:</p>
190
191
192
193
194 <pre class="prettyprint"><code>Ext.define('User', {
195     extend: 'Ext.data.Model',
196     fields: ['id'],
197
198     associations: [
199         {type: 'hasMany', model: 'Post',    name: 'posts'},
200         {type: 'hasMany', model: 'Comment', name: 'comments'}
201     ]
202 });
203 </code></pre>
204
205
206
207
208 <p><u>Using a Proxy</u></p>
209
210
211
212
213 <p>Models are great for representing types of data and relationships, but sooner or later we're going to want to
214 load or save that data somewhere. All loading and saving of data is handled via a <a href="Ext.data.proxy.Proxy.html" rel="Ext.data.proxy.Proxy" class="docClass">Proxy</a>,
215 which can be set directly on the Model:</p>
216
217
218
219
220 <pre class="prettyprint"><code>Ext.define('User', {
221     extend: 'Ext.data.Model',
222     fields: ['id', 'name', 'email'],
223
224     proxy: {
225         type: 'rest',
226         url : '/users'
227     }
228 });
229 </code></pre>
230
231
232
233
234 <p>Here we've set up a <a href="Ext.data.proxy.Rest.html" rel="Ext.data.proxy.Rest" class="docClass">Rest Proxy</a>, which knows how to load and save data to and from a
235 RESTful backend. Let's see how this works:</p>
236
237
238
239
240 <pre class="prettyprint"><code>var user = Ext.ModelManager.create({name: 'Ed Spencer', email: 'ed@sencha.com'}, 'User');
241
242 user.save(); //POST /users
243 </code></pre>
244
245
246
247
248 <p>Calling <a href="Ext.data.Model.html#save" rel="Ext.data.Model#save" class="docClass">save</a> on the new Model instance tells the configured RestProxy that we wish to persist this
249 Model's data onto our server. RestProxy figures out that this Model hasn't been saved before because it doesn't
250 have an id, and performs the appropriate action - in this case issuing a POST request to the url we configured
251 (/users). We configure any Proxy on any Model and always follow this API - see <a href="Ext.data.proxy.Proxy.html" rel="Ext.data.proxy.Proxy" class="docClass">Ext.data.proxy.Proxy</a> for a full
252 list.</p>
253
254
255
256
257 <p>Loading data via the Proxy is equally easy:</p>
258
259
260
261
262 <pre class="prettyprint"><code>//get a reference to the User model class
263 var User = Ext.ModelManager.getModel('User');
264
265 //Uses the configured RestProxy to make a GET request to /users/123
266 User.load(123, {
267     success: function(user) {
268         console.log(user.getId()); //logs 123
269     }
270 });
271 </code></pre>
272
273
274
275
276 <p>Models can also be updated and destroyed easily:</p>
277
278
279
280
281 <pre class="prettyprint"><code>//the user Model we loaded in the last snippet:
282 user.set('name', 'Edward Spencer');
283
284 //tells the Proxy to save the Model. In this case it will perform a PUT request to /users/123 as this Model already has an id
285 user.save({
286     success: function() {
287         console.log('The User was updated');
288     }
289 });
290
291 //tells the Proxy to destroy the Model. Performs a DELETE request to /users/123
292 user.destroy({
293     success: function() {
294         console.log('The User was destroyed!');
295     }
296 });
297 </code></pre>
298
299
300
301
302 <p><u>Usage in Stores</u></p>
303
304
305
306
307 <p>It is very common to want to load a set of Model instances to be displayed and manipulated in the UI. We do this
308 by creating a <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">Store</a>:</p>
309
310
311
312
313 <pre class="prettyprint"><code>var store = new Ext.data.Store({
314     model: 'User'
315 });
316
317 //uses the Proxy we set up on Model to load the Store data
318 store.load();
319 </code></pre>
320
321
322
323
324 <p>A Store is just a collection of Model instances - usually loaded from a server somewhere. Store can also maintain
325 a set of added, updated and removed Model instances to be synchronized with the server via the Proxy. See the
326 <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">Store docs</a> for more information on Stores.</p>
327
328 <div class="members"><div class="m-cfgs"><div class="definedBy">Defined By</div><a name="configs"></a><h3 class="cfg p">Config Options</h3><h4 class="cfgGroup">Other Configs</h4><div id="config-idProperty" class="member f ni"><a href="Ext.data.Model.html#config-idProperty" rel="config-idProperty" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-cfg-idProperty" class="viewSource">view source</a></div><a name="idProperty"></a><a name="config-idProperty"></a><a href="Ext.data.Model.html#" rel="config-idProperty" class="cls expand">idProperty</a><span> : String</span></div><div class="description"><div class="short"><p>The name of the field treated as this Model's unique id (defaults to 'id').</p>
329 </div><div class="long"><p>The name of the field treated as this Model's unique id (defaults to 'id').</p>
330 </div></div></div><div id="config-listeners" class="member inherited"><a href="Ext.data.Model.html#config-listeners" rel="config-listeners" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-cfg-listeners" class="viewSource">view source</a></div><a name="listeners"></a><a name="config-listeners"></a><a href="Ext.data.Model.html#" rel="config-listeners" class="cls expand">listeners</a><span> : Object</span></div><div class="description"><div class="short">(optional) A config object containing one or more event handlers to be added to this
331 object during initialization.  T...</div><div class="long"><p>(optional) <p>A config object containing one or more event handlers to be added to this
332 object during initialization.  This should be a valid listeners config object as specified in the
333 <a href="Ext.data.Model.html#addListener" rel="Ext.data.Model#addListener" class="docClass">addListener</a> example for attaching multiple handlers at once.</p></p>
334
335 <br><p><b><u>DOM events from ExtJs <a href="Ext.Component.html" rel="Ext.Component" class="docClass">Components</a></u></b></p>
336
337
338 <br><p>While <i>some</i> ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
339
340
341 <p>is usually only done when extra value can be added. For example the <a href="Ext.view.View.html" rel="Ext.view.View" class="docClass">DataView</a>'s
342 <b><code><a href="Ext.view.View.html#click" rel="Ext.view.View#click" class="docClass">click</a></code></b> event passing the node clicked on. To access DOM
343 events directly from a child element of a Component, we need to specify the <code>element</code> option to
344 identify the Component property to add a DOM listener to:</p>
345
346 <pre><code>new Ext.panel.Panel({
347     width: 400,
348     height: 200,
349     dockedItems: [{
350         xtype: 'toolbar'
351     }],
352     listeners: {
353         click: {
354             element: 'el', //bind to the underlying el property on the panel
355             fn: function(){ console.log('click el'); }
356         },
357         dblclick: {
358             element: 'body', //bind to the underlying body property on the panel
359             fn: function(){ console.log('dblclick body'); }
360         }
361     }
362 });
363 </code></pre>
364
365
366 <p></p></p>
367 </div></div></div><div id="config-persistanceProperty" class="member ni"><a href="Ext.data.Model.html#config-persistanceProperty" rel="config-persistanceProperty" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-cfg-persistanceProperty" class="viewSource">view source</a></div><a name="persistanceProperty"></a><a name="config-persistanceProperty"></a><a href="Ext.data.Model.html#" rel="config-persistanceProperty" class="cls expand">persistanceProperty</a><span> : String</span></div><div class="description"><div class="short">The property on this Persistable object that its data is saved to.
368 Defaults to 'data' (e.g. all persistable data resi...</div><div class="long"><p>The property on this Persistable object that its data is saved to.
369 Defaults to 'data' (e.g. all persistable data resides in this.data.)</p>
370 </div></div></div></div><div class="m-properties"><a name="properties"></a><div class="definedBy">Defined By</div><h3 class="prp p">Properties</h3><div id="property-defaultProxyType" class="member f ni"><a href="Ext.data.Model.html#property-defaultProxyType" rel="property-defaultProxyType" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-property-defaultProxyType" class="viewSource">view source</a></div><a name="defaultProxyType"></a><a name="property-defaultProxyType"></a><a href="Ext.data.Model.html#" rel="property-defaultProxyType" class="cls expand">defaultProxyType</a><span> : String</span></div><div class="description"><div class="short"><p>The string type of the default Model Proxy. Defaults to 'ajax'</p>
371 </div><div class="long"><p>The string type of the default Model Proxy. Defaults to 'ajax'</p>
372 </div></div></div><div id="property-dirty" class="member ni"><a href="Ext.data.Model.html#property-dirty" rel="property-dirty" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-property-dirty" class="viewSource">view source</a></div><a name="dirty"></a><a name="property-dirty"></a><a href="Ext.data.Model.html#" rel="property-dirty" class="cls expand">dirty</a><span> : Boolean</span></div><div class="description"><div class="short"><p>Readonly flag - true if this Record has been modified.</p>
373 </div><div class="long"><p>Readonly flag - true if this Record has been modified.</p>
374 </div></div></div><div id="property-editing" class="member ni"><a href="Ext.data.Model.html#property-editing" rel="property-editing" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-property-editing" class="viewSource">view source</a></div><a name="editing"></a><a name="property-editing"></a><a href="Ext.data.Model.html#" rel="property-editing" class="cls expand">editing</a><span> : Boolean</span></div><div class="description"><div class="short"><p>Internal flag used to track whether or not the model instance is currently being edited. Read-only</p>
375 </div><div class="long"><p>Internal flag used to track whether or not the model instance is currently being edited. Read-only</p>
376 </div></div></div><div id="property-fields" class="member ni"><a href="Ext.data.Model.html#property-fields" rel="property-fields" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-property-fields" class="viewSource">view source</a></div><a name="fields"></a><a name="property-fields"></a><a href="Ext.data.Model.html#" rel="property-fields" class="cls expand">fields</a><span> : Array</span></div><div class="description"><div class="short"><p>An array of the fields defined on this model</p>
377 </div><div class="long"><p>An array of the fields defined on this model</p>
378 </div></div></div><div id="property-modified" class="member ni"><a href="Ext.data.Model.html#property-modified" rel="property-modified" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-property-modified" class="viewSource">view source</a></div><a name="modified"></a><a name="property-modified"></a><a href="Ext.data.Model.html#" rel="property-modified" class="cls expand">modified</a><span> : Object</span></div><div class="description"><div class="short"><p>Key: value pairs of all fields whose values have changed</p>
379 </div><div class="long"><p>Key: value pairs of all fields whose values have changed</p>
380 </div></div></div><div id="property-phantom" class="member ni"><a href="Ext.data.Model.html#property-phantom" rel="property-phantom" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-property-phantom" class="viewSource">view source</a></div><a name="phantom"></a><a name="property-phantom"></a><a href="Ext.data.Model.html#" rel="property-phantom" class="cls expand">phantom</a><span> : Boolean</span></div><div class="description"><div class="short">true when the record does not yet exist in a server-side database (see
381 setDirty).  Any record which has a real databa...</div><div class="long"><p><tt>true</tt> when the record does not yet exist in a server-side database (see
382 <a href="Ext.data.Model.html#setDirty" rel="Ext.data.Model#setDirty" class="docClass">setDirty</a>).  Any record which has a real database pk set as its id property
383 is NOT a phantom -- it's real.</p>
384 </div></div></div><div id="property-store" class="member ni"><a href="Ext.data.Model.html#property-store" rel="property-store" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-property-store" class="viewSource">view source</a></div><a name="store"></a><a name="property-store"></a><a href="Ext.data.Model.html#" rel="property-store" class="cls expand">store</a><span> : Ext.data.Store</span></div><div class="description"><div class="short"><p>The <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">Ext.data.Store</a> to which this Record belongs.</p>
385 </div><div class="long"><p>The <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">Ext.data.Store</a> to which this Record belongs.</p>
386 </div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-Model" class="member f ni"><a href="Ext.data.Model.html#method-Model" rel="method-Model" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-constructor" class="viewSource">view source</a></div><a name="Model"></a><a name="method-Model"></a><a href="Ext.data.Model.html#" rel="method-Model" class="cls expand">Model</a>(
387 <span class="pre">Object data, Number id</span>)
388  : void</div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
389 <h3 class="pa">Parameters</h3><ul><li><span class="pre">data</span> : Object<div class="sub-desc"><p>An object containing keys corresponding to this model's fields, and their associated values</p>
390 </div></li><li><span class="pre">id</span> : Number<div class="sub-desc"><p>Optional unique ID to assign to this model instance</p>
391 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
392 </li></ul></div></div></div><div id="method-addEvents" class="member inherited"><a href="Ext.data.Model.html#method-addEvents" rel="method-addEvents" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-addEvents" class="viewSource">view source</a></div><a name="addEvents"></a><a name="method-addEvents"></a><a href="Ext.data.Model.html#" rel="method-addEvents" class="cls expand">addEvents</a>(
393 <span class="pre">Object/String o, String </span>)
394  : void</div><div class="description"><div class="short"><p>Adds the specified events to the list of events which this Observable may fire.</p>
395 </div><div class="long"><p>Adds the specified events to the list of events which this Observable may fire.</p>
396 <h3 class="pa">Parameters</h3><ul><li><span class="pre">o</span> : Object/String<div class="sub-desc"><p>Either an object with event names as properties with a value of <code>true</code>
397 or the first event name string if multiple event names are being passed as separate parameters.</p>
398 </div></li><li><span class="pre"></span> : String<div class="sub-desc"><p>[additional] Optional additional event names if multiple event names are being passed as separate parameters.
399 Usage:</p>
400
401 <pre><code>this.addEvents('storeloaded', 'storecleared');
402 </code></pre>
403
404 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
405 </li></ul></div></div></div><div id="method-addListener" class="member inherited"><a href="Ext.data.Model.html#method-addListener" rel="method-addListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-addListener" class="viewSource">view source</a></div><a name="addListener"></a><a name="method-addListener"></a><a href="Ext.data.Model.html#" rel="method-addListener" class="cls expand">addListener</a>(
406 <span class="pre">String eventName, Function handler, [Object scope], [Object options]</span>)
407  : void</div><div class="description"><div class="short"><p>Appends an event handler to this object.</p>
408 </div><div class="long"><p>Appends an event handler to this object.</p>
409 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The name of the event to listen for. May also be an object who's property names are event names. See</p>
410 </div></li><li><span class="pre">handler</span> : Function<div class="sub-desc"><p>The method the event invokes.</p>
411 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
412 <b>If omitted, defaults to the object which fired the event.</b></p>
413 </div></li><li><span class="pre">options</span> : Object<div class="sub-desc"><p>(optional) An object containing handler configuration.
414 properties. This may contain any of the following properties:<ul>
415 <li><b>scope</b> : Object<div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
416 <b>If omitted, defaults to the object which fired the event.</b></div></li>
417 <li><b>delay</b> : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
418 <li><b>single</b> : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
419 <li><b>buffer</b> : Number<div class="sub-desc">Causes the handler to be scheduled to run in an <a href="Ext.util.DelayedTask.html" rel="Ext.util.DelayedTask" class="docClass">Ext.util.DelayedTask</a> delayed
420 by the specified number of milliseconds. If the event fires again within that time, the original
421 handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
422 <li><b>target</b> : Observable<div class="sub-desc">Only call the handler if the event was fired on the target Observable, <i>not</i>
423 if the event was bubbled up from a child Observable.</div></li>
424 <li><b>element</b> : String<div class="sub-desc"><b>This option is only valid for listeners bound to <a href="Ext.Component.html" rel="Ext.Component" class="docClass">Components</a>.</b>
425 The name of a Component property which references an element to add a listener to.</p>
426
427 <p>This option is useful during Component construction to add DOM event listeners to elements of <a href="Ext.Component.html" rel="Ext.Component" class="docClass">Components</a> which
428 will exist only after the Component is rendered. For example, to add a click listener to a Panel's body:
429 <pre><code>new Ext.panel.Panel({
430     title: 'The title',
431     listeners: {
432         click: this.handlePanelClick,
433         element: 'body'
434     }
435 });
436 </code></pre></p>
437
438
439 <p>When added in this way, the options available are the options applicable to <a href="Ext.core.Element.html#addListener" rel="Ext.core.Element#addListener" class="docClass">Ext.core.Element.addListener</a></p>
440
441
442 <p></div></li>
443 </ul><br></p>
444
445 <p>
446 <b>Combining Options</b><br>
447 Using the options argument, it is possible to combine different types of listeners:<br>
448 <br>
449 A delayed, one-time listener.
450 <pre><code>myPanel.on('hide', this.handleClick, this, {
451 single: true,
452 delay: 100
453 });</code></pre>
454 <p>
455 <b>Attaching multiple handlers in 1 call</b><br>
456 The method also allows for a single argument to be passed which is a config object containing properties
457 which specify multiple events. For example:
458 <pre><code>myGridPanel.on({
459     cellClick: this.onCellClick,
460     mouseover: this.onMouseOver,
461     mouseout: this.onMouseOut,
462     scope: this // Important. Ensure "this" is correct during handler execution
463 });
464 </code></pre>.
465 <p>
466
467 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
468 </li></ul></div></div></div><div id="method-addManagedListener" class="member inherited"><a href="Ext.data.Model.html#method-addManagedListener" rel="method-addManagedListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-addManagedListener" class="viewSource">view source</a></div><a name="addManagedListener"></a><a name="method-addManagedListener"></a><a href="Ext.data.Model.html#" rel="method-addManagedListener" class="cls expand">addManagedListener</a>(
469 <span class="pre">Observable/Element item, Object/String ename, Function fn, Object scope, Object opt</span>)
470  : void</div><div class="description"><div class="short"><p>Adds listeners to any Observable object (or Element) which are automatically removed when this Component
471 is destroyed.
472
473 </div><div class="long"><p>Adds listeners to any Observable object (or Element) which are automatically removed when this Component
474 is destroyed.
475
476 <h3 class="pa">Parameters</h3><ul><li><span class="pre">item</span> : Observable/Element<div class="sub-desc"><p>The item to which to add a listener/listeners.</p>
477 </div></li><li><span class="pre">ename</span> : Object/String<div class="sub-desc"><p>The event name, or an object containing event name properties.</p>
478 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
479 is the handler function.</p>
480 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
481 is the scope (<code>this</code> reference) in which the handler function is executed.</p>
482 </div></li><li><span class="pre">opt</span> : Object<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
483 is the <a href="Ext.util.Observable.html#addListener" rel="Ext.util.Observable#addListener" class="docClass">addListener</a> options.</p>
484 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
485 </li></ul></div></div></div><div id="method-beginEdit" class="member ni"><a href="Ext.data.Model.html#method-beginEdit" rel="method-beginEdit" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-beginEdit" class="viewSource">view source</a></div><a name="beginEdit"></a><a name="method-beginEdit"></a><a href="Ext.data.Model.html#" rel="method-beginEdit" class="cls expand">beginEdit</a> : void</div><div class="description"><div class="short">Begin an edit. While in edit mode, no events (e.g.. the update event)
486 are relayed to the containing store. When an ed...</div><div class="long"><p>Begin an edit. While in edit mode, no events (e.g.. the <code>update</code> event)
487 are relayed to the containing store. When an edit has begun, it must be followed
488 by either <a href="Ext.data.Model.html#endEdit" rel="Ext.data.Model#endEdit" class="docClass">endEdit</a> or <a href="Ext.data.Model.html#cancelEdit" rel="Ext.data.Model#cancelEdit" class="docClass">cancelEdit</a>.</p>
489 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
490 </li></ul></div></div></div><div id="method-cancelEdit" class="member ni"><a href="Ext.data.Model.html#method-cancelEdit" rel="method-cancelEdit" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-cancelEdit" class="viewSource">view source</a></div><a name="cancelEdit"></a><a name="method-cancelEdit"></a><a href="Ext.data.Model.html#" rel="method-cancelEdit" class="cls expand">cancelEdit</a> : void</div><div class="description"><div class="short"><p>Cancels all changes made in the current edit operation.</p>
491 </div><div class="long"><p>Cancels all changes made in the current edit operation.</p>
492 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
493 </li></ul></div></div></div><div id="method-capture" class="member inherited"><a href="Ext.data.Model.html#method-capture" rel="method-capture" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-capture" class="viewSource">view source</a></div><a name="capture"></a><a name="method-capture"></a><a href="Ext.data.Model.html#" rel="method-capture" class="cls expand">capture</a>(
494 <span class="pre">Observable o, Function fn, [Object scope]</span>)
495  : void</div><div class="description"><div class="short">Starts capture on the specified Observable. All events will be passed
496 to the supplied function with the event name + ...</div><div class="long"><p>Starts capture on the specified Observable. All events will be passed
497 to the supplied function with the event name + standard signature of the event
498 <b>before</b> the event is fired. If the supplied function returns false,
499 the event will not fire.</p>
500 <h3 class="pa">Parameters</h3><ul><li><span class="pre">o</span> : Observable<div class="sub-desc"><p>The Observable to capture events from.</p>
501 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>The function to call when an event is fired.</p>
502 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Observable firing the event.</p>
503 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
504 </li></ul></div></div></div><div id="method-clearListeners" class="member inherited"><a href="Ext.data.Model.html#method-clearListeners" rel="method-clearListeners" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-clearListeners" class="viewSource">view source</a></div><a name="clearListeners"></a><a name="method-clearListeners"></a><a href="Ext.data.Model.html#" rel="method-clearListeners" class="cls expand">clearListeners</a> : void</div><div class="description"><div class="short"><p>Removes all listeners for this object including the managed listeners</p>
505 </div><div class="long"><p>Removes all listeners for this object including the managed listeners</p>
506 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
507 </li></ul></div></div></div><div id="method-clearManagedListeners" class="member inherited"><a href="Ext.data.Model.html#method-clearManagedListeners" rel="method-clearManagedListeners" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-clearManagedListeners" class="viewSource">view source</a></div><a name="clearManagedListeners"></a><a name="method-clearManagedListeners"></a><a href="Ext.data.Model.html#" rel="method-clearManagedListeners" class="cls expand">clearManagedListeners</a> : void</div><div class="description"><div class="short"><p>Removes all managed listeners for this object.</p>
508 </div><div class="long"><p>Removes all managed listeners for this object.</p>
509 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
510 </li></ul></div></div></div><div id="method-commit" class="member ni"><a href="Ext.data.Model.html#method-commit" rel="method-commit" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-commit" class="viewSource">view source</a></div><a name="commit"></a><a name="method-commit"></a><a href="Ext.data.Model.html#" rel="method-commit" class="cls expand">commit</a>(
511 <span class="pre">[Boolean silent]</span>)
512  : void</div><div class="description"><div class="short">Usually called by the Ext.data.Store which owns the model instance.
513 Commits all changes made to the instance since ei...</div><div class="long"><p>Usually called by the <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">Ext.data.Store</a> which owns the model instance.
514 Commits all changes made to the instance since either creation or the last commit operation.</p>
515
516 <p>Developers should subscribe to the <a href="Ext.data.Store.html#update" rel="Ext.data.Store#update" class="docClass">Ext.data.Store.update</a> event
517 to have their code notified of commit operations.</p>
518
519 <h3 class="pa">Parameters</h3><ul><li><span class="pre">silent</span> : Boolean<div class="sub-desc"><p>(optional) True to skip notification of the owning
520 store of the change (defaults to false)</p>
521 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
522 </li></ul></div></div></div><div id="method-copy" class="member ni"><a href="Ext.data.Model.html#method-copy" rel="method-copy" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-copy" class="viewSource">view source</a></div><a name="copy"></a><a name="method-copy"></a><a href="Ext.data.Model.html#" rel="method-copy" class="cls expand">copy</a>(
523 <span class="pre">[String id]</span>)
524  : Record</div><div class="description"><div class="short"><p>Creates a copy (clone) of this Model instance.</p>
525 </div><div class="long"><p>Creates a copy (clone) of this Model instance.</p>
526 <h3 class="pa">Parameters</h3><ul><li><span class="pre">id</span> : String<div class="sub-desc"><p>(optional) A new id, defaults to the id
527 of the instance being copied. See <code><a href="Ext.data.Model.html#id" rel="Ext.data.Model#id" class="docClass">id</a></code>.
528 To generate a phantom instance with a new id use:</p>
529
530 <pre><code>var rec = record.copy(); // clone the record
531 Ext.data.Model.id(rec); // automatically generate a unique sequential id
532 </code></pre>
533
534 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Record</span>&nbsp; &nbsp;
535 </li></ul></div></div></div><div id="method-destroy" class="member ni"><a href="Ext.data.Model.html#method-destroy" rel="method-destroy" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-destroy" class="viewSource">view source</a></div><a name="destroy"></a><a name="method-destroy"></a><a href="Ext.data.Model.html#" rel="method-destroy" class="cls expand">destroy</a>(
536 <span class="pre">Object options</span>)
537  : Ext.data.Model</div><div class="description"><div class="short"><p>Destroys the model using the configured proxy</p>
538 </div><div class="long"><p>Destroys the model using the configured proxy</p>
539 <h3 class="pa">Parameters</h3><ul><li><span class="pre">options</span> : Object<div class="sub-desc"><p>Options to pass to the proxy</p>
540 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.data.Model</span>&nbsp; &nbsp;<p>The Model instance</p>
541 </li></ul></div></div></div><div id="method-enableBubble" class="member inherited"><a href="Ext.data.Model.html#method-enableBubble" rel="method-enableBubble" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-enableBubble" class="viewSource">view source</a></div><a name="enableBubble"></a><a name="method-enableBubble"></a><a href="Ext.data.Model.html#" rel="method-enableBubble" class="cls expand">enableBubble</a>(
542 <span class="pre">String/Array events</span>)
543  : void</div><div class="description"><div class="short">Enables events fired by this Observable to bubble up an owner hierarchy by calling
544 this.getBubbleTarget() if present....</div><div class="long"><p>Enables events fired by this Observable to bubble up an owner hierarchy by calling
545 <code>this.getBubbleTarget()</code> if present. There is no implementation in the Observable base class.</p>
546
547
548 <p>This is commonly used by Ext.Components to bubble events to owner Containers. See <a href="Ext.Component.html#getBubbleTarget" rel="Ext.Component#getBubbleTarget" class="docClass">Ext.Component.getBubbleTarget</a>. The default
549 implementation in <a href="Ext.Component.html" rel="Ext.Component" class="docClass">Ext.Component</a> returns the Component's immediate owner. But if a known target is required, this can be overridden to
550 access the required target more quickly.</p>
551
552
553 <p>Example:</p>
554
555
556 <pre><code>Ext.override(Ext.form.field.Base, {
557 //  Add functionality to Field&#39;s initComponent to enable the change event to bubble
558 initComponent : Ext.Function.createSequence(Ext.form.field.Base.prototype.initComponent, function() {
559     this.enableBubble('change');
560 }),
561
562 //  We know that we want Field&#39;s events to bubble directly to the FormPanel.
563 getBubbleTarget : function() {
564     if (!this.formPanel) {
565         this.formPanel = this.findParentByType('form');
566     }
567     return this.formPanel;
568 }
569 });
570
571 var myForm = new Ext.formPanel({
572 title: 'User Details',
573 items: [{
574     ...
575 }],
576 listeners: {
577     change: function() {
578         // Title goes red if form has been modified.
579         myForm.header.setStyle('color', 'red');
580     }
581 }
582 });
583 </code></pre>
584
585 <h3 class="pa">Parameters</h3><ul><li><span class="pre">events</span> : String/Array<div class="sub-desc"><p>The event name to bubble, or an Array of event names.</p>
586 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
587 </li></ul></div></div></div><div id="method-endEdit" class="member ni"><a href="Ext.data.Model.html#method-endEdit" rel="method-endEdit" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-endEdit" class="viewSource">view source</a></div><a name="endEdit"></a><a name="method-endEdit"></a><a href="Ext.data.Model.html#" rel="method-endEdit" class="cls expand">endEdit</a>(
588 <span class="pre">Boolean silent</span>)
589  : void</div><div class="description"><div class="short"><p>End an edit. If any data was modified, the containing store is notified
590 (ie, the store's <code>update</code> event will fire).</p>
591 </div><div class="long"><p>End an edit. If any data was modified, the containing store is notified
592 (ie, the store's <code>update</code> event will fire).</p>
593 <h3 class="pa">Parameters</h3><ul><li><span class="pre">silent</span> : Boolean<div class="sub-desc"><p>True to not notify the store of the change</p>
594 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
595 </li></ul></div></div></div><div id="method-fireEvent" class="member inherited"><a href="Ext.data.Model.html#method-fireEvent" rel="method-fireEvent" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-fireEvent" class="viewSource">view source</a></div><a name="fireEvent"></a><a name="method-fireEvent"></a><a href="Ext.data.Model.html#" rel="method-fireEvent" class="cls expand">fireEvent</a>(
596 <span class="pre">String eventName, Object... args</span>)
597  : Boolean</div><div class="description"><div class="short">Fires the specified event with the passed parameters (minus the event name).
598
599
600 An event may be set to bubble up an Ob...</div><div class="long"><p>Fires the specified event with the passed parameters (minus the event name).</p>
601
602
603 <p>An event may be set to bubble up an Observable parent hierarchy (See <a href="Ext.Component.html#getBubbleTarget" rel="Ext.Component#getBubbleTarget" class="docClass">Ext.Component.getBubbleTarget</a>)
604 by calling <a href="Ext.data.Model.html#enableBubble" rel="Ext.data.Model#enableBubble" class="docClass">enableBubble</a>.</p>
605
606 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The name of the event to fire.</p>
607 </div></li><li><span class="pre">args</span> : Object...<div class="sub-desc"><p>Variable number of parameters are passed to handlers.</p>
608 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>returns false if any of the handlers return false otherwise it returns true.</p>
609 </li></ul></div></div></div><div id="method-get" class="member ni"><a href="Ext.data.Model.html#method-get" rel="method-get" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-get" class="viewSource">view source</a></div><a name="get"></a><a name="method-get"></a><a href="Ext.data.Model.html#" rel="method-get" class="cls expand">get</a>(
610 <span class="pre">String fieldName</span>)
611  : Mixed</div><div class="description"><div class="short"><p>Returns the value of the given field</p>
612 </div><div class="long"><p>Returns the value of the given field</p>
613 <h3 class="pa">Parameters</h3><ul><li><span class="pre">fieldName</span> : String<div class="sub-desc"><p>The field to fetch the value for</p>
614 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;<p>The value</p>
615 </li></ul></div></div></div><div id="method-getAssociatedData" class="member ni"><a href="Ext.data.Model.html#method-getAssociatedData" rel="method-getAssociatedData" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-getAssociatedData" class="viewSource">view source</a></div><a name="getAssociatedData"></a><a name="method-getAssociatedData"></a><a href="Ext.data.Model.html#" rel="method-getAssociatedData" class="cls expand">getAssociatedData</a> : Object</div><div class="description"><div class="short">Gets all of the data from this Models loaded associations.
616 It does this recursively - for example if we have a User w...</div><div class="long"><p>Gets all of the data from this Models <em>loaded</em> associations.
617 It does this recursively - for example if we have a User which
618 hasMany Orders, and each Order hasMany OrderItems, it will return an object like this:
619 {</p>
620
621 <pre><code>orders: [
622     {
623         id: 123,
624         status: 'shipped',
625         orderItems: [
626             ...
627         ]
628     }
629 ]
630 </code></pre>
631
632 <p>}</p>
633 <h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>The nested data set for the Model's loaded associations</p>
634 </li></ul></div></div></div><div id="method-getChanges" class="member ni"><a href="Ext.data.Model.html#method-getChanges" rel="method-getChanges" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-getChanges" class="viewSource">view source</a></div><a name="getChanges"></a><a name="method-getChanges"></a><a href="Ext.data.Model.html#" rel="method-getChanges" class="cls expand">getChanges</a> : void</div><div class="description"><div class="short"><p>Gets a hash of only the fields that have been modified since this Model was created or commited.</p>
635 </div><div class="long"><p>Gets a hash of only the fields that have been modified since this Model was created or commited.</p>
636 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;<p>Object</p>
637 </li></ul></div></div></div><div id="method-getId" class="member ni"><a href="Ext.data.Model.html#method-getId" rel="method-getId" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-getId" class="viewSource">view source</a></div><a name="getId"></a><a name="method-getId"></a><a href="Ext.data.Model.html#" rel="method-getId" class="cls expand">getId</a> : Number</div><div class="description"><div class="short"><p>Returns the unique ID allocated to this model instance as defined by <a href="Ext.data.Model.html#idProperty" rel="Ext.data.Model#idProperty" class="docClass">idProperty</a></p>
638 </div><div class="long"><p>Returns the unique ID allocated to this model instance as defined by <a href="Ext.data.Model.html#idProperty" rel="Ext.data.Model#idProperty" class="docClass">idProperty</a></p>
639 <h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The id</p>
640 </li></ul></div></div></div><div id="method-getProxy" class="member ni"><a href="Ext.data.Model.html#method-getProxy" rel="method-getProxy" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-getProxy" class="viewSource">view source</a></div><a name="getProxy"></a><a name="method-getProxy"></a><a href="Ext.data.Model.html#" rel="method-getProxy" class="cls expand">getProxy</a> : Ext.data.proxy.Proxy</div><div class="description"><div class="short"><p>Returns the configured Proxy for this Model</p>
641 </div><div class="long"><p>Returns the configured Proxy for this Model</p>
642 <h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.data.proxy.Proxy</span>&nbsp; &nbsp;<p>The proxy</p>
643 </li></ul></div></div></div><div id="method-hasListener" class="member inherited"><a href="Ext.data.Model.html#method-hasListener" rel="method-hasListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-hasListener" class="viewSource">view source</a></div><a name="hasListener"></a><a name="method-hasListener"></a><a href="Ext.data.Model.html#" rel="method-hasListener" class="cls expand">hasListener</a>(
644 <span class="pre">String eventName</span>)
645  : Boolean</div><div class="description"><div class="short"><p>Checks to see if this object has any listeners for a specified event</p>
646 </div><div class="long"><p>Checks to see if this object has any listeners for a specified event</p>
647 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The name of the event to check for</p>
648 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if the event is being listened for, else false</p>
649 </li></ul></div></div></div><div id="method-id" class="member ni"><a href="Ext.data.Model.html#method-id" rel="method-id" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-id" class="viewSource">view source</a></div><a name="id"></a><a name="method-id"></a><a href="Ext.data.Model.html#" rel="method-id" class="cls expand">id</a>(
650 <span class="pre">Ext.data.Model rec</span>)
651  : String</div><div class="description"><div class="short">Generates a sequential id. This method is typically called when a record is created
652 and no id has been specified. The...</div><div class="long"><p>Generates a sequential id. This method is typically called when a record is <a href="Ext.data.Model.html#create" rel="Ext.data.Model#create" class="docClass">create</a>d
653 and <a href="Ext.data.Model.html#Record" rel="Ext.data.Model#Record" class="docClass">no id has been specified</a>. The id will automatically be assigned
654 to the record. The returned id takes the form:
655 <tt>&#123;PREFIX}-&#123;AUTO_ID}</tt>.<div class="mdetail-params"><ul>
656 <li><b><tt>PREFIX</tt></b> : String<p class="sub-desc"><tt>Ext.data.Model.PREFIX</tt>
657 (defaults to <tt>'ext-record'</tt>)</p></li>
658 <li><b><tt>AUTO_ID</tt></b> : String<p class="sub-desc"><tt>Ext.data.Model.AUTO_ID</tt>
659 (defaults to <tt>1</tt> initially)</p></li>
660 </ul></div></p>
661 <h3 class="pa">Parameters</h3><ul><li><span class="pre">rec</span> : Ext.data.Model<div class="sub-desc"><p>The record being created.  The record does not exist, it's a <a href="Ext.data.Model.html#phantom" rel="Ext.data.Model#phantom" class="docClass">phantom</a>.</p>
662 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>auto-generated string id, <tt>"ext-record-i++'</tt>;</p>
663 </li></ul></div></div></div><div id="method-isModified" class="member ni"><a href="Ext.data.Model.html#method-isModified" rel="method-isModified" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-isModified" class="viewSource">view source</a></div><a name="isModified"></a><a name="method-isModified"></a><a href="Ext.data.Model.html#" rel="method-isModified" class="cls expand">isModified</a>(
664 <span class="pre">String fieldName</span>)
665  : Boolean</div><div class="description"><div class="short"><p>Returns <tt>true</tt> if the passed field name has been <code><a href="Ext.data.Model.html#modified" rel="Ext.data.Model#modified" class="docClass">modified</a></code>
666 since the load or last commit.</p>
667 </div><div class="long"><p>Returns <tt>true</tt> if the passed field name has been <code><a href="Ext.data.Model.html#modified" rel="Ext.data.Model#modified" class="docClass">modified</a></code>
668 since the load or last commit.</p>
669 <h3 class="pa">Parameters</h3><ul><li><span class="pre">fieldName</span> : String<div class="sub-desc"><p><a href="Ext.data.Field.html#name" rel="Ext.data.Field#name" class="docClass">Ext.data.Field.name</a></p>
670 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;
671 </li></ul></div></div></div><div id="method-isValid" class="member ni"><a href="Ext.data.Model.html#method-isValid" rel="method-isValid" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-isValid" class="viewSource">view source</a></div><a name="isValid"></a><a name="method-isValid"></a><a href="Ext.data.Model.html#" rel="method-isValid" class="cls expand">isValid</a> : Boolean</div><div class="description"><div class="short"><p>Checks if the model is valid. See <a href="Ext.data.Model.html#validate" rel="Ext.data.Model#validate" class="docClass">validate</a>.</p>
672 </div><div class="long"><p>Checks if the model is valid. See <a href="Ext.data.Model.html#validate" rel="Ext.data.Model#validate" class="docClass">validate</a>.</p>
673 <h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if the model is valid.</p>
674 </li></ul></div></div></div><div id="method-join" class="member ni"><a href="Ext.data.Model.html#method-join" rel="method-join" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-join" class="viewSource">view source</a></div><a name="join"></a><a name="method-join"></a><a href="Ext.data.Model.html#" rel="method-join" class="cls expand">join</a>(
675 <span class="pre">Ext.data.Store store</span>)
676  : void</div><div class="description"><div class="short"><p>Tells this model instance that it has been added to a store</p>
677 </div><div class="long"><p>Tells this model instance that it has been added to a store</p>
678 <h3 class="pa">Parameters</h3><ul><li><span class="pre">store</span> : Ext.data.Store<div class="sub-desc"><p>The store that the model has been added to</p>
679 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
680 </li></ul></div></div></div><div id="method-load" class="member ni"><a href="Ext.data.Model.html#method-load" rel="method-load" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-load" class="viewSource">view source</a></div><a name="load"></a><a name="method-load"></a><a href="Ext.data.Model.html#" rel="method-load" class="cls expand">load</a>(
681 <span class="pre">Number id, Object config</span>)
682  : void</div><div class="description"><div class="short">Static. Asynchronously loads a model instance by id. Sample usage:
683
684     MyApp.User = Ext.define('User', {
685         ext...</div><div class="long"><p><b>Static</b>. Asynchronously loads a model instance by id. Sample usage:</p>
686
687 <pre><code>    MyApp.User = Ext.define('User', {
688         extend: 'Ext.data.Model',
689         fields: [
690             {name: 'id', type: 'int'},
691             {name: 'name', type: 'string'}
692         ]
693     });
694
695     MyApp.User.load(10, {
696         scope: this,
697         failure: function(record, operation) {
698             //do something if the load failed
699         },
700         success: function(record, operation) {
701             //do something if the load succeeded
702         },
703         callback: function(record, operation) {
704             //do something whether the load succeeded or failed
705         }
706     });
707     </code></pre>
708
709 <h3 class="pa">Parameters</h3><ul><li><span class="pre">id</span> : Number<div class="sub-desc"><p>The id of the model to load</p>
710 </div></li><li><span class="pre">config</span> : Object<div class="sub-desc"><p>Optional config object containing success, failure and callback functions, plus optional scope</p>
711 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
712 </li></ul></div></div></div><div id="method-observe" class="member inherited"><a href="Ext.data.Model.html#method-observe" rel="method-observe" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-observe" class="viewSource">view source</a></div><a name="observe"></a><a name="method-observe"></a><a href="Ext.data.Model.html#" rel="method-observe" class="cls expand">observe</a>(
713 <span class="pre">Function c, Object listeners</span>)
714  : void</div><div class="description"><div class="short">Sets observability on the passed class constructor.
715
716 This makes any event fired on any instance of the passed class a...</div><div class="long"><p>Sets observability on the passed class constructor.</p>
717
718 <p>This makes any event fired on any instance of the passed class also fire a single event through
719 the <strong>class</strong> allowing for central handling of events on many instances at once.</p>
720
721 <p>Usage:</p>
722
723 <pre><code>Ext.util.Observable.observe(Ext.data.Connection);
724 Ext.data.Connection.on('beforerequest', function(con, options) {
725     console.log('Ajax request made to ' + options.url);
726 });
727 </code></pre>
728 <h3 class="pa">Parameters</h3><ul><li><span class="pre">c</span> : Function<div class="sub-desc"><p>The class constructor to make observable.</p>
729 </div></li><li><span class="pre">listeners</span> : Object<div class="sub-desc"><p>An object containing a series of listeners to add. See <a href="Ext.data.Model.html#addListener" rel="Ext.data.Model#addListener" class="docClass">addListener</a>.</p>
730 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
731 </li></ul></div></div></div><div id="method-on" class="member inherited"><a href="Ext.data.Model.html#method-on" rel="method-on" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-on" class="viewSource">view source</a></div><a name="on"></a><a name="method-on"></a><a href="Ext.data.Model.html#" rel="method-on" class="cls expand">on</a>(
732 <span class="pre">String eventName, Function handler, [Object scope], [Object options]</span>)
733  : void</div><div class="description"><div class="short"><p>Appends an event handler to this object (shorthand for <a href="Ext.data.Model.html#addListener" rel="Ext.data.Model#addListener" class="docClass">addListener</a>.)</p>
734 </div><div class="long"><p>Appends an event handler to this object (shorthand for <a href="Ext.data.Model.html#addListener" rel="Ext.data.Model#addListener" class="docClass">addListener</a>.)</p>
735 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The type of event to listen for</p>
736 </div></li><li><span class="pre">handler</span> : Function<div class="sub-desc"><p>The method the event invokes</p>
737 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
738 <b>If omitted, defaults to the object which fired the event.</b></p>
739 </div></li><li><span class="pre">options</span> : Object<div class="sub-desc"><p>(optional) An object containing handler configuration.</p>
740 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
741 </li></ul></div></div></div><div id="method-reject" class="member ni"><a href="Ext.data.Model.html#method-reject" rel="method-reject" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-reject" class="viewSource">view source</a></div><a name="reject"></a><a name="method-reject"></a><a href="Ext.data.Model.html#" rel="method-reject" class="cls expand">reject</a>(
742 <span class="pre">[Boolean silent]</span>)
743  : void</div><div class="description"><div class="short">Usually called by the Ext.data.Store to which this model instance has been joined.
744 Rejects all changes made to the mo...</div><div class="long"><p>Usually called by the <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">Ext.data.Store</a> to which this model instance has been <a href="Ext.data.Model.html#join" rel="Ext.data.Model#join" class="docClass">joined</a>.
745 Rejects all changes made to the model instance since either creation, or the last commit operation.
746 Modified fields are reverted to their original values.</p>
747
748 <p>Developers should subscribe to the <a href="Ext.data.Store.html#update" rel="Ext.data.Store#update" class="docClass">Ext.data.Store.update</a> event
749 to have their code notified of reject operations.</p>
750
751 <h3 class="pa">Parameters</h3><ul><li><span class="pre">silent</span> : Boolean<div class="sub-desc"><p>(optional) True to skip notification of the owning
752 store of the change (defaults to false)</p>
753 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
754 </li></ul></div></div></div><div id="method-relayEvents" class="member inherited"><a href="Ext.data.Model.html#method-relayEvents" rel="method-relayEvents" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-relayEvents" class="viewSource">view source</a></div><a name="relayEvents"></a><a name="method-relayEvents"></a><a href="Ext.data.Model.html#" rel="method-relayEvents" class="cls expand">relayEvents</a>(
755 <span class="pre">Object origin, Array events, Object prefix</span>)
756  : void</div><div class="description"><div class="short"><p>Relays selected events from the specified Observable as if the events were fired by <code><b>this</b></code>.</p>
757 </div><div class="long"><p>Relays selected events from the specified Observable as if the events were fired by <code><b>this</b></code>.</p>
758 <h3 class="pa">Parameters</h3><ul><li><span class="pre">origin</span> : Object<div class="sub-desc"><p>The Observable whose events this object is to relay.</p>
759 </div></li><li><span class="pre">events</span> : Array<div class="sub-desc"><p>Array of event names to relay.</p>
760 </div></li><li><span class="pre">prefix</span> : Object<div class="sub-desc">
761 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
762 </li></ul></div></div></div><div id="method-releaseCapture" class="member inherited"><a href="Ext.data.Model.html#method-releaseCapture" rel="method-releaseCapture" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-releaseCapture" class="viewSource">view source</a></div><a name="releaseCapture"></a><a name="method-releaseCapture"></a><a href="Ext.data.Model.html#" rel="method-releaseCapture" class="cls expand">releaseCapture</a>(
763 <span class="pre">Observable o</span>)
764  : void</div><div class="description"><div class="short"><p>Removes <b>all</b> added captures from the Observable.</p>
765 </div><div class="long"><p>Removes <b>all</b> added captures from the Observable.</p>
766 <h3 class="pa">Parameters</h3><ul><li><span class="pre">o</span> : Observable<div class="sub-desc"><p>The Observable to release</p>
767 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
768 </li></ul></div></div></div><div id="method-removeListener" class="member inherited"><a href="Ext.data.Model.html#method-removeListener" rel="method-removeListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-removeListener" class="viewSource">view source</a></div><a name="removeListener"></a><a name="method-removeListener"></a><a href="Ext.data.Model.html#" rel="method-removeListener" class="cls expand">removeListener</a>(
769 <span class="pre">String eventName, Function handler, [Object scope]</span>)
770  : void</div><div class="description"><div class="short"><p>Removes an event handler.</p>
771 </div><div class="long"><p>Removes an event handler.</p>
772 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The type of event the handler was associated with.</p>
773 </div></li><li><span class="pre">handler</span> : Function<div class="sub-desc"><p>The handler to remove. <b>This must be a reference to the function passed into the <a href="Ext.data.Model.html#addListener" rel="Ext.data.Model#addListener" class="docClass">addListener</a> call.</b></p>
774 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope originally specified for the handler.</p>
775 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
776 </li></ul></div></div></div><div id="method-removeManagedListener" class="member inherited"><a href="Ext.data.Model.html#method-removeManagedListener" rel="method-removeManagedListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-removeManagedListener" class="viewSource">view source</a></div><a name="removeManagedListener"></a><a name="method-removeManagedListener"></a><a href="Ext.data.Model.html#" rel="method-removeManagedListener" class="cls expand">removeManagedListener</a>(
777 <span class="pre">Observable|Element item, Object|String ename, Function fn, Object scope</span>)
778  : void</div><div class="description"><div class="short"><p>Removes listeners that were added by the <a href="Ext.data.Model.html#mon" rel="Ext.data.Model#mon" class="docClass">mon</a> method.</p>
779 </div><div class="long"><p>Removes listeners that were added by the <a href="Ext.data.Model.html#mon" rel="Ext.data.Model#mon" class="docClass">mon</a> method.</p>
780 <h3 class="pa">Parameters</h3><ul><li><span class="pre">item</span> : Observable|Element<div class="sub-desc"><p>The item from which to remove a listener/listeners.</p>
781 </div></li><li><span class="pre">ename</span> : Object|String<div class="sub-desc"><p>The event name, or an object containing event name properties.</p>
782 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
783 is the handler function.</p>
784 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
785 is the scope (<code>this</code> reference) in which the handler function is executed.</p>
786 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
787 </li></ul></div></div></div><div id="method-resumeEvents" class="member inherited"><a href="Ext.data.Model.html#method-resumeEvents" rel="method-resumeEvents" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-resumeEvents" class="viewSource">view source</a></div><a name="resumeEvents"></a><a name="method-resumeEvents"></a><a href="Ext.data.Model.html#" rel="method-resumeEvents" class="cls expand">resumeEvents</a> : void</div><div class="description"><div class="short">Resume firing events. (see suspendEvents)
788 If events were suspended using the queueSuspended parameter, then all
789 event...</div><div class="long"><p>Resume firing events. (see <a href="Ext.data.Model.html#suspendEvents" rel="Ext.data.Model#suspendEvents" class="docClass">suspendEvents</a>)
790 If events were suspended using the <code><b>queueSuspended</b></code> parameter, then all
791 events fired during event suspension will be sent to any listeners now.</p>
792 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
793 </li></ul></div></div></div><div id="method-save" class="member ni"><a href="Ext.data.Model.html#method-save" rel="method-save" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-save" class="viewSource">view source</a></div><a name="save"></a><a name="method-save"></a><a href="Ext.data.Model.html#" rel="method-save" class="cls expand">save</a>(
794 <span class="pre">Object options</span>)
795  : Ext.data.Model</div><div class="description"><div class="short"><p>Saves the model instance using the configured proxy</p>
796 </div><div class="long"><p>Saves the model instance using the configured proxy</p>
797 <h3 class="pa">Parameters</h3><ul><li><span class="pre">options</span> : Object<div class="sub-desc"><p>Options to pass to the proxy</p>
798 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.data.Model</span>&nbsp; &nbsp;<p>The Model instance</p>
799 </li></ul></div></div></div><div id="method-set" class="member ni"><a href="Ext.data.Model.html#method-set" rel="method-set" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-set" class="viewSource">view source</a></div><a name="set"></a><a name="method-set"></a><a href="Ext.data.Model.html#" rel="method-set" class="cls expand">set</a>(
800 <span class="pre">String|Object fieldName, Mixed value</span>)
801  : void</div><div class="description"><div class="short"><p>Sets the given field to the given value, marks the instance as dirty</p>
802 </div><div class="long"><p>Sets the given field to the given value, marks the instance as dirty</p>
803 <h3 class="pa">Parameters</h3><ul><li><span class="pre">fieldName</span> : String|Object<div class="sub-desc"><p>The field to set, or an object containing key/value pairs</p>
804 </div></li><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>The value to set</p>
805 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
806 </li></ul></div></div></div><div id="method-setDirty" class="member ni"><a href="Ext.data.Model.html#method-setDirty" rel="method-setDirty" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-setDirty" class="viewSource">view source</a></div><a name="setDirty"></a><a name="method-setDirty"></a><a href="Ext.data.Model.html#" rel="method-setDirty" class="cls expand">setDirty</a> : void</div><div class="description"><div class="short">Marks this Record as dirty.  This method
807 is used interally when adding phantom records to a
808 writer enabled store.
809
810
811 M...</div><div class="long"><p>Marks this <b>Record</b> as <code><a href="Ext.data.Model.html#dirty" rel="Ext.data.Model#dirty" class="docClass">dirty</a></code>.  This method
812 is used interally when adding <code><a href="Ext.data.Model.html#phantom" rel="Ext.data.Model#phantom" class="docClass">phantom</a></code> records to a
813 <a href="Ext.data.Store.html#writer" rel="Ext.data.Store#writer" class="docClass">writer enabled store</a>.</p>
814
815
816 <br><p>Marking a record <code><a href="Ext.data.Model.html#dirty" rel="Ext.data.Model#dirty" class="docClass">dirty</a></code> causes the phantom to
817
818
819 <p>be returned by <a href="Ext.data.Store.html#getModifiedRecords" rel="Ext.data.Store#getModifiedRecords" class="docClass">Ext.data.Store.getModifiedRecords</a> where it will
820 have a create action composed for it during <a href="Ext.data.Store.html#save" rel="Ext.data.Store#save" class="docClass">store save</a>
821 operations.</p></p>
822 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
823 </li></ul></div></div></div><div id="method-setId" class="member ni"><a href="Ext.data.Model.html#method-setId" rel="method-setId" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-setId" class="viewSource">view source</a></div><a name="setId"></a><a name="method-setId"></a><a href="Ext.data.Model.html#" rel="method-setId" class="cls expand">setId</a>(
824 <span class="pre">Number id</span>)
825  : void</div><div class="description"><div class="short"><p>Sets the model instance's id field to the given id</p>
826 </div><div class="long"><p>Sets the model instance's id field to the given id</p>
827 <h3 class="pa">Parameters</h3><ul><li><span class="pre">id</span> : Number<div class="sub-desc"><p>The new id</p>
828 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
829 </li></ul></div></div></div><div id="method-setProxy" class="member ni"><a href="Ext.data.Model.html#method-setProxy" rel="method-setProxy" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-setProxy" class="viewSource">view source</a></div><a name="setProxy"></a><a name="method-setProxy"></a><a href="Ext.data.Model.html#" rel="method-setProxy" class="cls expand">setProxy</a>(
830 <span class="pre">String/Object/Ext.data.proxy.Proxy proxy</span>)
831  : void</div><div class="description"><div class="short"><p>Sets the Proxy to use for this model. Accepts any options that can be accepted by <a href="Ext.html#createByAlias" rel="Ext#createByAlias" class="docClass">Ext.createByAlias</a></p>
832 </div><div class="long"><p>Sets the Proxy to use for this model. Accepts any options that can be accepted by <a href="Ext.html#createByAlias" rel="Ext#createByAlias" class="docClass">Ext.createByAlias</a></p>
833 <h3 class="pa">Parameters</h3><ul><li><span class="pre">proxy</span> : String/Object/Ext.data.proxy.Proxy<div class="sub-desc"><p>The proxy</p>
834 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
835 </li></ul></div></div></div><div id="method-suspendEvents" class="member inherited"><a href="Ext.data.Model.html#method-suspendEvents" rel="method-suspendEvents" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-suspendEvents" class="viewSource">view source</a></div><a name="suspendEvents"></a><a name="method-suspendEvents"></a><a href="Ext.data.Model.html#" rel="method-suspendEvents" class="cls expand">suspendEvents</a>(
836 <span class="pre">Boolean queueSuspended</span>)
837  : void</div><div class="description"><div class="short"><p>Suspend the firing of all events. (see <a href="Ext.data.Model.html#resumeEvents" rel="Ext.data.Model#resumeEvents" class="docClass">resumeEvents</a>)</p>
838 </div><div class="long"><p>Suspend the firing of all events. (see <a href="Ext.data.Model.html#resumeEvents" rel="Ext.data.Model#resumeEvents" class="docClass">resumeEvents</a>)</p>
839 <h3 class="pa">Parameters</h3><ul><li><span class="pre">queueSuspended</span> : Boolean<div class="sub-desc"><p>Pass as true to queue up suspended events to be fired
840 after the <a href="Ext.data.Model.html#resumeEvents" rel="Ext.data.Model#resumeEvents" class="docClass">resumeEvents</a> call instead of discarding all suspended events;</p>
841 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
842 </li></ul></div></div></div><div id="method-un" class="member inherited"><a href="Ext.data.Model.html#method-un" rel="method-un" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-un" class="viewSource">view source</a></div><a name="un"></a><a name="method-un"></a><a href="Ext.data.Model.html#" rel="method-un" class="cls expand">un</a>(
843 <span class="pre">String eventName, Function handler, [Object scope]</span>)
844  : void</div><div class="description"><div class="short"><p>Removes an event handler (shorthand for <a href="Ext.data.Model.html#removeListener" rel="Ext.data.Model#removeListener" class="docClass">removeListener</a>.)</p>
845 </div><div class="long"><p>Removes an event handler (shorthand for <a href="Ext.data.Model.html#removeListener" rel="Ext.data.Model#removeListener" class="docClass">removeListener</a>.)</p>
846 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The type of event the handler was associated with.</p>
847 </div></li><li><span class="pre">handler</span> : Function<div class="sub-desc"><p>The handler to remove. <b>This must be a reference to the function passed into the <a href="Ext.data.Model.html#addListener" rel="Ext.data.Model#addListener" class="docClass">addListener</a> call.</b></p>
848 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope originally specified for the handler.</p>
849 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
850 </li></ul></div></div></div><div id="method-unjoin" class="member ni"><a href="Ext.data.Model.html#method-unjoin" rel="method-unjoin" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-unjoin" class="viewSource">view source</a></div><a name="unjoin"></a><a name="method-unjoin"></a><a href="Ext.data.Model.html#" rel="method-unjoin" class="cls expand">unjoin</a> : void</div><div class="description"><div class="short"><p>Tells this model instance that it has been removed from the store</p>
851 </div><div class="long"><p>Tells this model instance that it has been removed from the store</p>
852 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
853 </li></ul></div></div></div><div id="method-validate" class="member ni"><a href="Ext.data.Model.html#method-validate" rel="method-validate" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Model.html" class="definedIn docClass">Ext.data.Model</a><br/><a href="../source/Model.html#Ext-data.Model-method-validate" class="viewSource">view source</a></div><a name="validate"></a><a name="method-validate"></a><a href="Ext.data.Model.html#" rel="method-validate" class="cls expand">validate</a> : Ext.data.Errors</div><div class="description"><div class="short"><p>Validates the current data against all of its configured <a href="Ext.data.Model.html#validations" rel="Ext.data.Model#validations" class="docClass">validations</a> and returns an
854 <a href="Ext.data.Errors.html" rel="Ext.data.Errors" class="docClass">Errors</a> object</p>
855 </div><div class="long"><p>Validates the current data against all of its configured <a href="Ext.data.Model.html#validations" rel="Ext.data.Model#validations" class="docClass">validations</a> and returns an
856 <a href="Ext.data.Errors.html" rel="Ext.data.Errors" class="docClass">Errors</a> object</p>
857 <h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.data.Errors</span>&nbsp; &nbsp;<p>The errors object</p>
858 </li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>