Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / docs / output / Ext.data.Record.html
1 <div class="body-wrap" xmlns:ext="http://www.extjs.com"><div class="top-tools"><a class="inner-link" href="#Ext.data.Record-props"><img src="resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>&#13;<a class="inner-link" href="#Ext.data.Record-methods"><img src="resources/images/default/s.gif" class="item-icon icon-method">Methods</a>&#13;<a class="inner-link" href="#Ext.data.Record-events"><img src="resources/images/default/s.gif" class="item-icon icon-event">Events</a>&#13;<a class="bookmark" href="../docs/?class=Ext.data.Record"><img src="resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>&#13;</div><h1>Class <a href="source/Record.html#cls-Ext.data.Record">Ext.data.Record</a></h1><table cellspacing="0"><tr><td class="label">Package:</td><td class="hd-info">Ext.data</td></tr><tr><td class="label">Defined In:</td><td class="hd-info">Record.js</td></tr><tr><td class="label">Class:</td><td class="hd-info"><a href="source/Record.html#cls-Ext.data.Record">Record</a></td></tr><tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr><tr><td class="hd-info"></td></tr></table><div class="description"><p>Instances of this class encapsulate both Record <em>definition</em> information, and Record
2 <em>value</em> information for use in <a href="output/Ext.data.Store.html" ext:cls="Ext.data.Store">Ext.data.Store</a> objects, or any code which needs
3 to access Records cached in an <a href="output/Ext.data.Store.html" ext:cls="Ext.data.Store">Ext.data.Store</a> object.</p>
4 <p>Constructors for this class are generated by passing an Array of field definition objects to <a href="output/Ext.data.Record.html#Ext.data.Record-create" ext:member="create" ext:cls="Ext.data.Record">create</a>.
5 Instances are usually only created by <a href="output/Ext.data.Reader.html" ext:cls="Ext.data.Reader">Ext.data.Reader</a> implementations when processing unformatted data
6 objects.</p>
7 <p>Note that an instance of a Record class may only belong to one <a href="output/Ext.data.Store.html" ext:cls="Ext.data.Store">Store</a> at a time.
8 In order to copy data from one Store to another, use the <a href="output/Ext.data.Record.html#Ext.data.Record-copy" ext:member="copy" ext:cls="Ext.data.Record">copy</a> method to create an exact
9 copy of the Record, and insert the new instance into the other Store.</p>
10 <p>When serializing a Record for submission to the server, be aware that it contains many private
11 properties, and also a reference to its owning Store which in turn holds references to its Records.
12 This means that a whole Record may not be encoded using <a href="output/Ext.util.JSON.encode.html" ext:cls="Ext.util.JSON.encode">Ext.util.JSON.encode</a>. Instead, use the
13 <code><a href="output/Ext.data.Record.html#Ext.data.Record-data" ext:member="data" ext:cls="Ext.data.Record">data</a></code> and <code><a href="output/Ext.data.Record.html#Ext.data.Record-id" ext:member="id" ext:cls="Ext.data.Record">id</a></code> properties.</p>
14 <p>Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below.</p></div><div class="hr"></div><a id="Ext.data.Record-props"></a><h2>Public Properties</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Property</th><th class="msource-header">Defined By</th></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-data"></a><b><a href="source/Record.html#prop-Ext.data.Record-data">data</a></b> : Object<div class="mdesc"><div class="short">An object hash representing the data for this Record. Every field name in the Record definition\r
15 is represented by a p...</div><div class="long">An object hash representing the data for this Record. Every field name in the Record definition
16 is represented by a property of that name in this object. Note that unless you specified a field
17 with <a href="output/Ext.data.Field.html#Ext.data.Field-name" ext:member="name" ext:cls="Ext.data.Field">name</a> "id" in the Record definition, this will <b>not</b> contain
18 an <tt>id</tt> property.</div></div></td><td class="msource">Record</td></tr><tr class="property-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-dirty"></a><b><a href="source/Record.html#prop-Ext.data.Record-dirty">dirty</a></b> : Boolean<div class="mdesc">Readonly flag - true if this Record has been modified.</div></td><td class="msource">Record</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-fields"></a><b><a href="source/Record.html#prop-Ext.data.Record-fields">fields</a></b> : Ext.util.MixedCollection<div class="mdesc"><div class="short">This property is stored in the Record definition's prototype\r
19 A MixedCollection containing the defined Fields for this...</div><div class="long"><p><b>This property is stored in the Record definition's <u>prototype</u></b></p>
20 A MixedCollection containing the defined <a href="output/Ext.data.Field.html" ext:cls="Ext.data.Field">Field</a>s for this Record.  Read-only.</div></div></td><td class="msource">Record</td></tr><tr class="property-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-id"></a><b><a href="source/Record.html#prop-Ext.data.Record-id">id</a></b> : Object<div class="mdesc">The unique ID of the Record <a href="output/Ext.data.Record.html#Ext.data.Record-Record" ext:member="Record" ext:cls="Ext.data.Record">as specified at construction time</a>.</div></td><td class="msource">Record</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-modified"></a><b><a href="source/Record.html#prop-Ext.data.Record-modified">modified</a></b> : Object<div class="mdesc"><div class="short">This object contains a key and value storing the original values of all modified\r
21 fields or is null if no fields have ...</div><div class="long">This object contains a key and value storing the original values of all modified
22 fields or is null if no fields have been modified.</div></div></td><td class="msource">Record</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-phantom"></a><b><a href="source/Record.html#prop-Ext.data.Record-phantom">phantom</a></b> : Boolean<div class="mdesc"><div class="short">false when the record does not yet exist in a server-side database (see\r
23 markDirty).  Any record which has a real data...</div><div class="long"><tt>false</tt> when the record does not yet exist in a server-side database (see
24 <a href="output/Ext.data.Record.html#Ext.data.Record-markDirty" ext:member="markDirty" ext:cls="Ext.data.Record">markDirty</a>).  Any record which has a real database pk set as its id property
25 is NOT a phantom -- it's real.</div></div></td><td class="msource">Record</td></tr><tr class="property-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-store"></a><b><a href="source/Record.html#prop-Ext.data.Record-store">store</a></b> : Ext.data.Store<div class="mdesc">The <a href="output/Ext.data.Store.html" ext:cls="Ext.data.Store">Ext.data.Store</a> to which this Record belongs.</div></td><td class="msource">Record</td></tr></tbody></table><a id="Ext.data.Record-methods"></a><h2>Public Methods</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Method</th><th class="msource-header">Defined By</th></tr><tr class="method-row expandable"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-Record"></a><b><a href="source/Record.html#cls-Ext.data.Record">Record</a></b>(&nbsp;<span title="Optional" class="optional">[<code>Object&nbsp;data</code>]</span>,&nbsp;<span title="Optional" class="optional">[<code>Object&nbsp;id</code>]</span>&nbsp;)\r
26     <div class="mdesc"><div class="short">This constructor should not be used to create Record objects. Instead, use create to\r
27 generate a subclass of Ext.data....</div><div class="long"><p>This constructor should not be used to create Record objects. Instead, use <a href="output/Ext.data.Record.html#Ext.data.Record-create" ext:member="create" ext:cls="Ext.data.Record">create</a> to
28 generate a subclass of Ext.data.Record configured with information about its constituent fields.<p>
29 <p><b>The generated constructor has the same signature as this constructor.</b></p><div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>data</code> : Object<div class="sub-desc">(Optional) An object, the properties of which provide values for the new Record's
30 fields. If not specified the <code><a href="output/Ext.data.Field.html#Ext.data.Field-defaultValue" ext:member="defaultValue" ext:cls="Ext.data.Field">defaultValue</a></code>
31 for each field will be assigned.</div></li><li><code>id</code> : Object<div class="sub-desc">(Optional) The id of the Record. This id should be unique, and is used by the
32 <a href="output/Ext.data.Store.html" ext:cls="Ext.data.Store">Ext.data.Store</a> object which owns the Record to index its collection of Records. If
33 an <code>id</code> is not specified a <b><code><a href="output/Ext.data.Record.html#Ext.data.Record-phantom" ext:member="phantom" ext:cls="Ext.data.Record">phantom</a></code></b> Record will be created
34 with an <a href="output/Ext.data.Record.html#Ext.data.Record-Record.id" ext:member="Record.id" ext:cls="Ext.data.Record">automatically generated id</a>.</div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-Record.id"></a><b><a href="source/Record.html#method-Ext.data.Record-Record.id">Record.id</a></b>(&nbsp;<code>Record&nbsp;rec</code>&nbsp;)\r
35     :\r
36                                         String<div class="mdesc"><div class="short">Generates a sequential id. This method is typically called when a record is created\r
37 and no id has been specified. The...</div><div class="long">Generates a sequential id. This method is typically called when a record is <a href="output/Ext.data.Record.html#Ext.data.Record-create" ext:member="create" ext:cls="Ext.data.Record">create</a>d
38 and <a href="output/Ext.data.Record.html#Ext.data.Record-Record" ext:member="Record" ext:cls="Ext.data.Record">no id has been specified</a>. The returned id takes the form:
39 <tt>&#123;PREFIX}-&#123;AUTO_ID}</tt>.<div class="mdetail-params"><ul>
40 <li><b><tt>PREFIX</tt></b> : String<p class="sub-desc"><tt>Ext.data.Record.PREFIX</tt>
41 (defaults to <tt>'ext-record'</tt>)</p></li>
42 <li><b><tt>AUTO_ID</tt></b> : String<p class="sub-desc"><tt>Ext.data.Record.AUTO_ID</tt>
43 (defaults to <tt>1</tt> initially)</p></li>
44 </ul></div><div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>rec</code> : Record<div class="sub-desc">The record being created.  The record does not exist, it's a <a href="output/Ext.data.Record.html#Ext.data.Record-phantom" ext:member="phantom" ext:cls="Ext.data.Record">phantom</a>.</div></li></ul><strong>Returns:</strong><ul><li><code>String</code><div class="sub-desc">auto-generated string id, &lt;tt&gt;"ext-record-i++'&lt;/tt&gt;;</div></li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-beginEdit"></a><b><a href="source/Record.html#method-Ext.data.Record-beginEdit">beginEdit</a></b>()\r
45     :\r
46                                         void<div class="mdesc"><div class="short">Begin an edit. While in edit mode, no events (e.g.. the update event)\r
47 are relayed to the containing store.\r
48 See also: ...</div><div class="long">Begin an edit. While in edit mode, no events (e.g.. the <code>update</code> event)
49 are relayed to the containing store.
50 See also: <code><a href="output/Ext.data.Record.html#Ext.data.Record-endEdit" ext:member="endEdit" ext:cls="Ext.data.Record">endEdit</a></code> and <code><a href="output/Ext.data.Record.html#Ext.data.Record-cancelEdit" ext:member="cancelEdit" ext:cls="Ext.data.Record">cancelEdit</a></code>.<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-cancelEdit"></a><b><a href="source/Record.html#method-Ext.data.Record-cancelEdit">cancelEdit</a></b>()\r
51     :\r
52                                         void<div class="mdesc"><div class="short">Cancels all changes made in the current edit operation.</div><div class="long">Cancels all changes made in the current edit operation.<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-commit"></a><b><a href="source/Record.html#method-Ext.data.Record-commit">commit</a></b>(&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;silent</code>]</span>&nbsp;)\r
53     :\r
54                                         void<div class="mdesc"><div class="short">Usually called by the Ext.data.Store which owns the Record.\r
55 Commits all changes made to the Record since either creat...</div><div class="long">Usually called by the <a href="output/Ext.data.Store.html" ext:cls="Ext.data.Store">Ext.data.Store</a> which owns the Record.
56 Commits all changes made to the Record since either creation, or the last commit operation.
57 <p>Developers should subscribe to the <a href="output/Ext.data.Store.html#Ext.data.Store-update" ext:member="update" ext:cls="Ext.data.Store">Ext.data.Store.update</a> event
58 to have their code notified of commit operations.</p><div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>silent</code> : Boolean<div class="sub-desc">(optional) True to skip notification of the owning
59 store of the change (defaults to false)</div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-copy"></a><b><a href="source/Record.html#method-Ext.data.Record-copy">copy</a></b>(&nbsp;<span title="Optional" class="optional">[<code>String&nbsp;id</code>]</span>&nbsp;)\r
60     :\r
61                                         Record<div class="mdesc"><div class="short">Creates a copy of this Record.</div><div class="long">Creates a copy of this Record.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>id</code> : String<div class="sub-desc">(optional) A new Record id, defaults to <a href="output/Ext.data.Record.html#Ext.data.Record-Record.id" ext:member="Record.id" ext:cls="Ext.data.Record">autogenerating an id</a>.
62 Note: if an <code>id</code> is not specified the copy created will be a
63 <code><a href="output/Ext.data.Record.html#Ext.data.Record-phantom" ext:member="phantom" ext:cls="Ext.data.Record">phantom</a></code> Record.</div></li></ul><strong>Returns:</strong><ul><li><code>Record</code><div class="sub-desc"></div></li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-create"></a><b><a href="source/Record.html#method-Ext.data.Record-create">create</a></b>(&nbsp;<code>Array&nbsp;o</code>&nbsp;)\r
64     :\r
65                                         function<div class="mdesc"><div class="short">&lt;static&gt;&nbsp;Generate a constructor for a specific Record layout.</div><div class="long">&lt;static&gt;&nbsp;Generate a constructor for a specific Record layout.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>o</code> : Array<div class="sub-desc">An Array of <b><a href="output/Ext.data.Field.html" ext:cls="Ext.data.Field">Field</a></b> definition objects.
66 The constructor generated by this method may be used to create new Record instances. The data
67 object must contain properties named after the <a href="output/Ext.data.Field.html" ext:cls="Ext.data.Field">field</a>
68 <b><tt><a href="output/Ext.data.Field.html#Ext.data.Field-name" ext:member="name" ext:cls="Ext.data.Field">Ext.data.Field.name</a>s</tt></b>.  Example usage:<pre><code><i>// create a Record constructor from a description of the fields</i>
69 <b>var</b> TopicRecord = Ext.data.Record.create([ <i>// creates a subclass of Ext.data.Record</i>
70     {<a href="output/Ext.data.Field.html#Ext.data.Field-name" ext:member="name" ext:cls="Ext.data.Field">name</a>: <em>'title'</em>, <a href="output/Ext.data.Field.html#Ext.data.Field-mapping" ext:member="mapping" ext:cls="Ext.data.Field">mapping</a>: <em>'topic_title'</em>},
71     {name: <em>'author'</em>, mapping: <em>'username'</em>, allowBlank: false},
72     {name: <em>'totalPosts'</em>, mapping: <em>'topic_replies'</em>, type: <em>'int'</em>},
73     {name: <em>'lastPost'</em>, mapping: <em>'post_time'</em>, type: <em>'date'</em>},
74     {name: <em>'lastPoster'</em>, mapping: <em>'user2'</em>},
75     {name: <em>'excerpt'</em>, mapping: <em>'post_text'</em>, allowBlank: false},
76     <i>// In the simplest <b>case</b>, <b>if</b> no properties other than <tt>name</tt> are required,</i>
77     <i>// a field definition may consist of just a String <b>for</b> the field name.</i>
78     <em>'signature'</em>
79 ]);
80
81 <i>// create Record instance</i>
82 <b>var</b> myNewRecord = <b>new</b> TopicRecord(
83     {
84         title: <em>'Do my job please'</em>,
85         author: <em>'noobie'</em>,
86         totalPosts: 1,
87         lastPost: <b>new</b> Date(),
88         lastPoster: <em>'Animal'</em>,
89         excerpt: <em>'No way dude!'</em>,
90         signature: <em>''</em>
91     },
92     id <i>// optionally specify the id of the record otherwise <a href="output/Ext.data.Record.html#Ext.data.Record-Record.id" ext:member="Record.id" ext:cls="Ext.data.Record">one is auto-assigned</a></i>
93 );
94 myStore.<a href="output/Ext.data.Store.html#Ext.data.Store-add" ext:member="add" ext:cls="Ext.data.Store">add</a>(myNewRecord);</code></pre></div></li></ul><strong>Returns:</strong><ul><li><code>function</code><div class="sub-desc">A constructor which is used to create new Records according\r
95 to the definition. The constructor has the same signature as {@link #Record}.</div></li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-endEdit"></a><b><a href="source/Record.html#method-Ext.data.Record-endEdit">endEdit</a></b>()\r
96     :\r
97                                         void<div class="mdesc"><div class="short">End an edit. If any data was modified, the containing store is notified\r
98 (ie, the store's update event will fire).</div><div class="long">End an edit. If any data was modified, the containing store is notified
99 (ie, the store's <code>update</code> event will fire).<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-get"></a><b><a href="source/Record.html#method-Ext.data.Record-get">get</a></b>(&nbsp;<code>String&nbsp;name</code>&nbsp;)\r
100     :\r
101                                         Object<div class="mdesc"><div class="short">Get the value of the named field.</div><div class="long">Get the value of the <a href="output/Ext.data.Field.html#Ext.data.Field-name" ext:member="name" ext:cls="Ext.data.Field">named field</a>.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>name</code> : String<div class="sub-desc">The <a href="output/Ext.data.Field.html#Ext.data.Field-name" ext:member="name" ext:cls="Ext.data.Field">name of the field</a> to get the value of.</div></li></ul><strong>Returns:</strong><ul><li><code>Object</code><div class="sub-desc">The value of the field.</div></li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-getChanges"></a><b><a href="source/Record.html#method-Ext.data.Record-getChanges">getChanges</a></b>()\r
102     :\r
103                                         Object<div class="mdesc"><div class="short">Gets a hash of only the fields that have been modified since this Record was created or commited.</div><div class="long">Gets a hash of only the fields that have been modified since this Record was created or commited.<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li><code>Object</code><div class="sub-desc"></div></li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-isModified"></a><b><a href="source/Record.html#method-Ext.data.Record-isModified">isModified</a></b>(&nbsp;<code>String&nbsp;fieldName</code>&nbsp;)\r
104     :\r
105                                         Boolean<div class="mdesc"><div class="short">Returns true if the passed field name has been modified\r
106 since the load or last commit.</div><div class="long">Returns <tt>true</tt> if the passed field name has been <code><a href="output/Ext.data.Record.html#Ext.data.Record-modified" ext:member="modified" ext:cls="Ext.data.Record">modified</a></code>
107 since the load or last commit.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>fieldName</code> : String<div class="sub-desc"><a href="output/Ext.data.Field.{@link.html" ext:cls="Ext.data.Field.{@link">Ext.data.Field#name</a></div></li></ul><strong>Returns:</strong><ul><li><code>Boolean</code><div class="sub-desc"></div></li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-isValid"></a><b><a href="source/Record.html#method-Ext.data.Record-isValid">isValid</a></b>()\r
108     :\r
109                                         Boolean<div class="mdesc"><div class="short">By default returns false if any field within the\r
110 record configured with Ext.data.Field.allowBlank = false returns\r
111 tru...</div><div class="long">By default returns <tt>false</tt> if any <a href="output/Ext.data.Field.html" ext:cls="Ext.data.Field">field</a> within the
112 record configured with <tt><a href="output/Ext.data.Field.html#Ext.data.Field-allowBlank" ext:member="allowBlank" ext:cls="Ext.data.Field">Ext.data.Field.allowBlank</a> = false</tt> returns
113 <tt>true</tt> from an <a href="output/Ext.html" ext:cls="Ext">Ext</a>.<a href="output/Ext.html#Ext-isEmpty" ext:member="isEmpty" ext:cls="Ext">isempty</a> test.<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li><code>Boolean</code><div class="sub-desc"></div></li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-markDirty"></a><b><a href="source/Record.html#method-Ext.data.Record-markDirty">markDirty</a></b>()\r
114     :\r
115                                         void<div class="mdesc"><div class="short">Marks this Record as dirty.  This method\r
116 is used interally when adding phantom records to a\r
117 writer enabled store.\r
118 Mar...</div><div class="long"><p>Marks this <b>Record</b> as <code><a href="output/Ext.data.Record.html#Ext.data.Record-dirty" ext:member="dirty" ext:cls="Ext.data.Record">dirty</a></code>.  This method
119 is used interally when adding <code><a href="output/Ext.data.Record.html#Ext.data.Record-phantom" ext:member="phantom" ext:cls="Ext.data.Record">phantom</a></code> records to a
120 <a href="output/Ext.data.Store.html#Ext.data.Store-writer" ext:member="writer" ext:cls="Ext.data.Store">writer enabled store</a>.</p>
121 <br><p>Marking a record <code><a href="output/Ext.data.Record.html#Ext.data.Record-dirty" ext:member="dirty" ext:cls="Ext.data.Record">dirty</a></code> causes the phantom to
122 be returned by <a href="output/Ext.data.Store.html#Ext.data.Store-getModifiedRecords" ext:member="getModifiedRecords" ext:cls="Ext.data.Store">Ext.data.Store.getModifiedRecords</a> where it will
123 have a create action composed for it during <a href="output/Ext.data.Store.html#Ext.data.Store-save" ext:member="save" ext:cls="Ext.data.Store">store save</a>
124 operations.</p><div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-reject"></a><b><a href="source/Record.html#method-Ext.data.Record-reject">reject</a></b>(&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;silent</code>]</span>&nbsp;)\r
125     :\r
126                                         void<div class="mdesc"><div class="short">Usually called by the Ext.data.Store which owns the Record.\r
127 Rejects all changes made to the Record since either creat...</div><div class="long">Usually called by the <a href="output/Ext.data.Store.html" ext:cls="Ext.data.Store">Ext.data.Store</a> which owns the Record.
128 Rejects all changes made to the Record since either creation, or the last commit operation.
129 Modified fields are reverted to their original values.
130 <p>Developers should subscribe to the <a href="output/Ext.data.Store.html#Ext.data.Store-update" ext:member="update" ext:cls="Ext.data.Store">Ext.data.Store.update</a> event
131 to have their code notified of reject operations.</p><div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>silent</code> : Boolean<div class="sub-desc">(optional) True to skip notification of the owning
132 store of the change (defaults to false)</div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Record</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.Record-set"></a><b><a href="source/Record.html#method-Ext.data.Record-set">set</a></b>(&nbsp;<code>String&nbsp;name</code>,&nbsp;<code>Object&nbsp;value</code>&nbsp;)\r
133     :\r
134                                         void<div class="mdesc"><div class="short">Set the named field to the specified value.  For example:\r
135 // record has a field named 'firstname'\r
136 var Employee = Ext....</div><div class="long">Set the <a href="output/Ext.data.Field.html#Ext.data.Field-name" ext:member="name" ext:cls="Ext.data.Field">named field</a> to the specified value.  For example:
137 <pre><code><i>// record has a field named <em>'firstname'</em></i>
138 <b>var</b> Employee = Ext.data.Record.<a href="output/Ext.data.Record.html#Ext.data.Record-create" ext:member="create" ext:cls="Ext.data.Record">create</a>([
139     {name: <em>'firstname'</em>},
140     ...
141 ]);
142
143 <i>// update the 2nd record <b>in</b> the store:</i>
144 <b>var</b> rec = myStore.<a href="output/Ext.data.Store.html#Ext.data.Store-getAt" ext:member="getAt" ext:cls="Ext.data.Store">getAt</a>(1);
145
146 <i>// set the value (shows dirty flag):</i>
147 rec.set(<em>'firstname'</em>, <em>'Betty'</em>);
148
149 <i>// commit the change (removes dirty flag):</i>
150 rec.<a href="output/Ext.data.Record.html#Ext.data.Record-commit" ext:member="commit" ext:cls="Ext.data.Record">commit</a>();
151
152 <i>// update the record <b>in</b> the store, bypass setting dirty flag,</i>
153 <i>// and <b>do</b> not store the change <b>in</b> the <a href="output/Ext.data.Store.html#Ext.data.Store-getModifiedRecords" ext:member="getModifiedRecords" ext:cls="Ext.data.Store">modified records</a></i>
154 rec.<a href="output/Ext.data.Record.html#Ext.data.Record-data" ext:member="data" ext:cls="Ext.data.Record">data</a>[<em>'firstname'</em>] = <em>'Wilma'</em>); <i>// updates record, but not the view</i>
155 rec.<a href="output/Ext.data.Record.html#Ext.data.Record-commit" ext:member="commit" ext:cls="Ext.data.Record">commit</a>(); <i>// updates the view</i></code></pre>
156 <b>Notes</b>:<div class="mdetail-params"><ul>
157 <li>If the store has a writer and <code>autoSave=true</code>, each set()
158 will execute an XHR to the server.</li>
159 <li>Use <code><a href="output/Ext.data.Record.html#Ext.data.Record-beginEdit" ext:member="beginEdit" ext:cls="Ext.data.Record">beginEdit</a></code> to prevent the store's <code>update</code>
160 event firing while using set().</li>
161 <li>Use <code><a href="output/Ext.data.Record.html#Ext.data.Record-endEdit" ext:member="endEdit" ext:cls="Ext.data.Record">endEdit</a></code> to have the store's <code>update</code>
162 event fire.</li>
163 </ul></div><div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>name</code> : String<div class="sub-desc">The <a href="output/Ext.data.Field.html#Ext.data.Field-name" ext:member="name" ext:cls="Ext.data.Field">name of the field</a> to set.</div></li><li><code>value</code> : Object<div class="sub-desc">The value to set the field to.</div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Record</td></tr></tbody></table><a id="Ext.data.Record-events"></a><h2>Public Events</h2><div class="no-members">This class has no public events.</div></div>