source: trunk/web/addons/job_monarch/lib/extjs/docs/output/Ext.data.Record.html @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 24.2 KB
Line 
1        <div class="body-wrap">
2        <div class="top-tools">
3            <a class="inner-link" href="#Ext.data.Record-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
4            <a class="inner-link" href="#Ext.data.Record-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
5            <a class="inner-link" href="#Ext.data.Record-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
6                        <a class="bookmark" href="../docs/?class=Ext.data.Record"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
7        </div>
8                <h1>Class Ext.data.Record</h1>
9        <table cellspacing="0">
10            <tr><td class="label">Package:</td><td class="hd-info">Ext.data</td></tr>
11            <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/Record.js" target="_blank">Record.js</a></td></tr>
12            <tr><td class="label">Class:</td><td class="hd-info">Record</td></tr>
13                                    <tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr>
14                    </table>
15        <div class="description">
16            *
17<p>Instances of this class encapsulate both Record <em>definition</em> information, and Record
18<em>value</em> information for use in <a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Ext.data.Store</a> objects, or any code which needs
19to access Records cached in an <a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Ext.data.Store</a> object.</p>
20<p>Constructors for this class are generated by passing an Array of field definition objects to <a ext:cls="Ext.data.Record" ext:member="create" href="output/Ext.data.Record.html#create">create</a>.
21Instances are usually only created by <a ext:cls="Ext.data.Reader" href="output/Ext.data.Reader.html">Ext.data.Reader</a> implementations when processing unformatted data
22objects.</p>
23<p>Note that an instance of a Record class may only belong to one <a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Store</a> at a time.
24In order to copy data from one Store to another, use the <a ext:cls="Ext.data.Record" ext:member="copy" href="output/Ext.data.Record.html#copy">copy</a> method to create an exact
25copy of the Record, and insert the new instance into the other Store.</p>
26<p>When serializing a Record for submission to the server, be aware that it contains many private
27properties, and also a reference to its owning Store which in turn holds references to its Records.
28This means that a Record may not be encoded using <a ext:cls="Ext.util.JSON.encode" href="output/Ext.util.JSON.encode.html">Ext.util.JSON.encode</a>. Instead, use the
29<a ext:cls="data" href="output/data.html">data</a> and <a ext:cls="id" href="output/id.html">id</a> properties.</p>
30Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below.        </div>
31       
32        <div class="hr"></div>
33                <a id="Ext.data.Record-props"></a>
34        <h2>Public Properties</h2>
35                <table cellspacing="0" class="member-table">
36            <tr>
37                <th class="sig-header" colspan="2">Property</th>
38                <th class="msource-header">Defined By</th>
39            </tr>
40                <tr class="property-row expandable">
41        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
42        <td class="sig">
43        <a id="Ext.data.Record-data"></a>
44            <b>data</b> : Object            <div class="mdesc">
45                        <div class="short">
46An object hash representing the data for this Record. Every field name in the Record definition
47is represented by a ...</div>
48            <div class="long">
49               
50An object hash representing the data for this Record. Every field name in the Record definition
51is represented by a property of that name in this object. Note that unless you specified a field
52with name "id" in the Record definition, this will <b>not</b> contain an <tt>id</tt> property.            </div>
53                        </div>
54        </td>
55        <td class="msource">Record</td>
56    </tr>
57        <tr class="property-row alt">
58        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
59        <td class="sig">
60        <a id="Ext.data.Record-dirty"></a>
61            <b>dirty</b> : Boolean            <div class="mdesc">
62                           
63Readonly flag - true if this Record has been modified.                        </div>
64        </td>
65        <td class="msource">Record</td>
66    </tr>
67        <tr class="property-row expandable">
68        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
69        <td class="sig">
70        <a id="Ext.data.Record-fields"></a>
71            <b>fields</b> : Ext.util.MixedCollection            <div class="mdesc">
72                        <div class="short">This property is stored in the Record definition's prototype
73A MixedCollection containing the defined Fields for this...</div>
74            <div class="long">
75                <p><b>This property is stored in the Record definition's <u>prototype</u></b></p>
76A MixedCollection containing the defined <a ext:cls="Ext.data.Field" href="output/Ext.data.Field.html">Field</a>s for this Record.  Read-only.            </div>
77                        </div>
78        </td>
79        <td class="msource">Record</td>
80    </tr>
81        <tr class="property-row alt">
82        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
83        <td class="sig">
84        <a id="Ext.data.Record-id"></a>
85            <b>id</b> : Object            <div class="mdesc">
86                           
87The unique ID of the Record as specified at construction time.                        </div>
88        </td>
89        <td class="msource">Record</td>
90    </tr>
91        <tr class="property-row expandable">
92        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
93        <td class="sig">
94        <a id="Ext.data.Record-modified"></a>
95            <b>modified</b> : Object            <div class="mdesc">
96                        <div class="short">This object contains a key and value storing the original values of all modified fields or is null if no fields have ...</div>
97            <div class="long">
98                This object contains a key and value storing the original values of all modified fields or is null if no fields have been modified.            </div>
99                        </div>
100        </td>
101        <td class="msource">Record</td>
102    </tr>
103            </table>
104                <a id="Ext.data.Record-methods"></a>
105        <h2>Public Methods</h2>
106                <table cellspacing="0" class="member-table">
107            <tr>
108                <th class="sig-header" colspan="2">Method</th>
109                <th class="msource-header">Defined By</th>
110            </tr>
111                <tr class="method-row expandable">
112        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
113        <td class="sig">
114        <a id="Ext.data.Record-Record"></a>
115            <b>Record</b>(&nbsp;<code>Array data</code>, <span class="optional" title="Optional">[<code>Object id</code>]</span>&nbsp;)            <div class="mdesc">
116                        <div class="short">This constructor should not be used to create Record objects. Instead, use the constructor generated by
117create. The p...</div>
118            <div class="long">
119                This constructor should not be used to create Record objects. Instead, use the constructor generated by
120<a ext:cls="Ext.data.Record" ext:member="create" href="output/Ext.data.Record.html#create">create</a>. The parameters are the same.    <div class="mdetail-params">
121        <strong>Parameters:</strong>
122        <ul><li><code>data</code> : Array<div class="sub-desc">An object, the properties of which provide values for the new Record's fields.</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
123<a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Ext.data.Store</a> object which owns the Record to index its collection of Records. If
124not specified an integer id is generated.</div></li>        </ul>
125        <strong>Returns:</strong>
126        <ul>
127            <li><code></code></li>
128        </ul>
129    </div>
130                </div>
131                        </div>
132        </td>
133        <td class="msource">Record</td>
134    </tr>
135        <tr class="method-row alt expandable">
136        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
137        <td class="sig">
138        <a id="Ext.data.Record-beginEdit"></a>
139            <b>beginEdit</b>() : void            <div class="mdesc">
140                        <div class="short">Begin an edit. While in edit mode, no events are relayed to the containing store.</div>
141            <div class="long">
142                Begin an edit. While in edit mode, no events are relayed to the containing store.    <div class="mdetail-params">
143        <strong>Parameters:</strong>
144        <ul><li>None.</li>        </ul>
145        <strong>Returns:</strong>
146        <ul>
147            <li><code>void</code></li>
148        </ul>
149    </div>
150                </div>
151                        </div>
152        </td>
153        <td class="msource">Record</td>
154    </tr>
155        <tr class="method-row expandable">
156        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
157        <td class="sig">
158        <a id="Ext.data.Record-cancelEdit"></a>
159            <b>cancelEdit</b>() : void            <div class="mdesc">
160                        <div class="short">Cancels all changes made in the current edit operation.</div>
161            <div class="long">
162                Cancels all changes made in the current edit operation.    <div class="mdetail-params">
163        <strong>Parameters:</strong>
164        <ul><li>None.</li>        </ul>
165        <strong>Returns:</strong>
166        <ul>
167            <li><code>void</code></li>
168        </ul>
169    </div>
170                </div>
171                        </div>
172        </td>
173        <td class="msource">Record</td>
174    </tr>
175        <tr class="method-row alt expandable">
176        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
177        <td class="sig">
178        <a id="Ext.data.Record-commit"></a>
179            <b>commit</b>(&nbsp;<span class="optional" title="Optional">[<code>Boolean silent</code>]</span>&nbsp;) : void            <div class="mdesc">
180                        <div class="short">Usually called by the Ext.data.Store which owns the Record.
181Commits all changes made to the Record since either creat...</div>
182            <div class="long">
183                Usually called by the <a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Ext.data.Store</a> which owns the Record.
184Commits all changes made to the Record since either creation, or the last commit operation.
185<p>
186Developers should subscribe to the <a ext:cls="Ext.data.Store" ext:member="update" href="output/Ext.data.Store.html#update">Ext.data.Store.update</a> event to have their code notified
187of commit operations.    <div class="mdetail-params">
188        <strong>Parameters:</strong>
189        <ul><li><code>silent</code> : Boolean<div class="sub-desc">(optional) True to skip notification of the owning store of the change (defaults to false)</div></li>        </ul>
190        <strong>Returns:</strong>
191        <ul>
192            <li><code>void</code></li>
193        </ul>
194    </div>
195                </div>
196                        </div>
197        </td>
198        <td class="msource">Record</td>
199    </tr>
200        <tr class="method-row expandable">
201        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
202        <td class="sig">
203        <a id="Ext.data.Record-copy"></a>
204            <b>copy</b>(&nbsp;<span class="optional" title="Optional">[<code>String id</code>]</span>&nbsp;) : Record            <div class="mdesc">
205                        <div class="short">Creates a copy of this Record.</div>
206            <div class="long">
207                Creates a copy of this Record.    <div class="mdetail-params">
208        <strong>Parameters:</strong>
209        <ul><li><code>id</code> : String<div class="sub-desc">(optional) A new Record id if you don't want to use this Record's id</div></li>        </ul>
210        <strong>Returns:</strong>
211        <ul>
212            <li><code>Record</code></li>
213        </ul>
214    </div>
215                </div>
216                        </div>
217        </td>
218        <td class="msource">Record</td>
219    </tr>
220        <tr class="method-row alt expandable">
221        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
222        <td class="sig">
223        <a id="Ext.data.Record-create"></a>
224            <b>create</b>(&nbsp;<span class="optional" title="Optional">[<code>Array o</code>]</span>&nbsp;) : function            <div class="mdesc">
225                        <div class="short">&lt;static&gt; Generate a constructor for a specific Record layout.</div>
226            <div class="long">
227                &lt;static&gt; Generate a constructor for a specific Record layout.    <div class="mdetail-params">
228        <strong>Parameters:</strong>
229        <ul><li><code>o</code> : Array<div class="sub-desc">An Array of field definition objects which specify field names, and optionally,
230data types, and a mapping for an <a ext:cls="Ext.data.Reader" href="output/Ext.data.Reader.html">Ext.data.Reader</a> to extract the field's value from a data object.
231Each field definition object may contain the following properties: <ul>
232<li><b>name</b> : String<div class="sub-desc">The name by which the field is referenced within the Record. This is referenced by,
233for example, the <em>dataIndex</em> property in column definition objects passed to <a ext:cls="Ext.grid.ColumnModel" href="output/Ext.grid.ColumnModel.html">Ext.grid.ColumnModel</a></div></li>
234<li><b>mapping</b> : String<div class="sub-desc">(Optional) A path specification for use by the <a ext:cls="Ext.data.Reader" href="output/Ext.data.Reader.html">Ext.data.Reader</a> implementation
235that is creating the Record to access the data value from the data object. If an <a ext:cls="Ext.data.JsonReader" href="output/Ext.data.JsonReader.html">Ext.data.JsonReader</a>
236is being used, then this is a string containing the javascript expression to reference the data relative to
237the Record item's root. If an <a ext:cls="Ext.data.XmlReader" href="output/Ext.data.XmlReader.html">Ext.data.XmlReader</a> is being used, this is an <a ext:cls="Ext.DomQuery" href="output/Ext.DomQuery.html">Ext.DomQuery</a> path
238to the data item relative to the Record element. If the mapping expression is the same as the field name,
239this may be omitted.</div></li>
240<li><b>type</b> : String<div class="sub-desc">(Optional) The data type for conversion to displayable value. Possible values are
241<ul><li>auto (Default, implies no conversion)</li>
242<li>string</li>
243<li>int</li>
244<li>float</li>
245<li>boolean</li>
246<li>date</li></ul></div></li>
247<li><b>sortType</b> : Function<div class="sub-desc">(Optional) A function which converts a Field's value to a comparable value
248in order to ensure correct sort ordering. Predefined functions are provided in <a ext:cls="Ext.data.SortTypes" href="output/Ext.data.SortTypes.html">Ext.data.SortTypes</a>.</div></li>
249<li><b>sortDir</b> : String<div class="sub-desc">(Optional) Initial direction to sort. "ASC" or "DESC"</div></li>
250<li><b>convert</b> : Function<div class="sub-desc">(Optional) A function which converts the value provided
251by the Reader into an object that will be stored in the Record. It is passed the
252following parameters:<ul>
253<li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader.</div></li>
254<li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
255Depending on Reader type, this could be an Array, an object, or an XML element.</div></li>
256</ul></div></li>
257<li><b>dateFormat</b> : String<div class="sub-desc">(Optional) A format string for the <a ext:cls="Date" ext:member="parseDate" href="output/Date.html#parseDate">Date.parseDate</a> function,
258or "timestamp" if the value provided by the Reader is a UNIX timestamp, or "time" if the value provided by the Reader is a
259javascript millisecond timestamp.</div></li>
260<li><b>defaultValue</b> : Mixed<div class="sub-desc">(Optional) The default value used <b>when a Record is being created by a
261<a ext:cls="Ext.data.Reader" href="output/Ext.data.Reader.html">Reader</a></b> when the item referenced by the <b><tt>mapping</tt></b> does not exist in the data object
262(i.e. undefined). (defaults to "")</div></li>
263</ul>
264The constructor generated by this method may be used to create new Record instances. The data object must contain properties
265named after the field <b>names</b>.
266<br>usage:<br><pre><code>var TopicRecord = Ext.data.Record.create([
267    {name: <em>'title'</em>, mapping: <em>'topic_title'</em>},
268    {name: <em>'author'</em>, mapping: <em>'username'</em>},
269    {name: <em>'totalPosts'</em>, mapping: <em>'topic_replies'</em>, type: <em>'int'</em>},
270    {name: <em>'lastPost'</em>, mapping: <em>'post_time'</em>, type: <em>'date'</em>},
271    {name: <em>'lastPoster'</em>, mapping: <em>'user2'</em>},
272    {name: <em>'excerpt'</em>, mapping: <em>'post_text'</em>}
273]);
274
275<b>var</b> myNewRecord = <b>new</b> TopicRecord({
276    title: <em>'Do my job please'</em>,
277    author: <em>'noobie'</em>,
278    totalPosts: 1,
279    lastPost: <b>new</b> Date(),
280    lastPoster: <em>'Animal'</em>,
281    excerpt: <em>'No way dude!'</em>
282});
283myStore.add(myNewRecord);</code></pre>
284<p>In the simplest case, if no properties other than <tt>name</tt> are required, a field definition
285may consist of just a field name string.</p></div></li>        </ul>
286        <strong>Returns:</strong>
287        <ul>
288            <li><code>function</code><div class="sub-desc">A constructor which is used to create new Records according to the definition.</div></li>
289        </ul>
290    </div>
291                </div>
292                        </div>
293        </td>
294        <td class="msource">Record</td>
295    </tr>
296        <tr class="method-row expandable">
297        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
298        <td class="sig">
299        <a id="Ext.data.Record-endEdit"></a>
300            <b>endEdit</b>() : void            <div class="mdesc">
301                        <div class="short">End an edit. If any data was modified, the containing store is notified.</div>
302            <div class="long">
303                End an edit. If any data was modified, the containing store is notified.    <div class="mdetail-params">
304        <strong>Parameters:</strong>
305        <ul><li>None.</li>        </ul>
306        <strong>Returns:</strong>
307        <ul>
308            <li><code>void</code></li>
309        </ul>
310    </div>
311                </div>
312                        </div>
313        </td>
314        <td class="msource">Record</td>
315    </tr>
316        <tr class="method-row alt expandable">
317        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
318        <td class="sig">
319        <a id="Ext.data.Record-get"></a>
320            <b>get</b>(&nbsp;<code>String name</code>&nbsp;) : Object            <div class="mdesc">
321                        <div class="short">Get the value of the named field.</div>
322            <div class="long">
323                Get the value of the named field.    <div class="mdetail-params">
324        <strong>Parameters:</strong>
325        <ul><li><code>name</code> : String<div class="sub-desc">The name of the field to get the value of.</div></li>        </ul>
326        <strong>Returns:</strong>
327        <ul>
328            <li><code>Object</code><div class="sub-desc">The value of the field.</div></li>
329        </ul>
330    </div>
331                </div>
332                        </div>
333        </td>
334        <td class="msource">Record</td>
335    </tr>
336        <tr class="method-row expandable">
337        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
338        <td class="sig">
339        <a id="Ext.data.Record-getChanges"></a>
340            <b>getChanges</b>() : Object            <div class="mdesc">
341                        <div class="short">Gets a hash of only the fields that have been modified since this Record was created or commited.</div>
342            <div class="long">
343                Gets a hash of only the fields that have been modified since this Record was created or commited.    <div class="mdetail-params">
344        <strong>Parameters:</strong>
345        <ul><li>None.</li>        </ul>
346        <strong>Returns:</strong>
347        <ul>
348            <li><code>Object</code></li>
349        </ul>
350    </div>
351                </div>
352                        </div>
353        </td>
354        <td class="msource">Record</td>
355    </tr>
356        <tr class="method-row alt expandable">
357        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
358        <td class="sig">
359        <a id="Ext.data.Record-isModified"></a>
360            <b>isModified</b>(&nbsp;<code>String fieldName</code>&nbsp;) : Boolean            <div class="mdesc">
361                        <div class="short">Returns true if the field passed has been modified since the load or last commit.</div>
362            <div class="long">
363                Returns true if the field passed has been modified since the load or last commit.    <div class="mdetail-params">
364        <strong>Parameters:</strong>
365        <ul><li><code>fieldName</code> : String<div class="sub-desc"></div></li>        </ul>
366        <strong>Returns:</strong>
367        <ul>
368            <li><code>Boolean</code></li>
369        </ul>
370    </div>
371                </div>
372                        </div>
373        </td>
374        <td class="msource">Record</td>
375    </tr>
376        <tr class="method-row expandable">
377        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
378        <td class="sig">
379        <a id="Ext.data.Record-reject"></a>
380            <b>reject</b>(&nbsp;<span class="optional" title="Optional">[<code>Boolean silent</code>]</span>&nbsp;) : void            <div class="mdesc">
381                        <div class="short">Usually called by the Ext.data.Store which owns the Record.
382Rejects all changes made to the Record since either creat...</div>
383            <div class="long">
384                Usually called by the <a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Ext.data.Store</a> which owns the Record.
385Rejects all changes made to the Record since either creation, or the last commit operation.
386Modified fields are reverted to their original values.
387<p>
388Developers should subscribe to the <a ext:cls="Ext.data.Store" ext:member="update" href="output/Ext.data.Store.html#update">Ext.data.Store.update</a> event to have their code notified
389of reject operations.    <div class="mdetail-params">
390        <strong>Parameters:</strong>
391        <ul><li><code>silent</code> : Boolean<div class="sub-desc">(optional) True to skip notification of the owning store of the change (defaults to false)</div></li>        </ul>
392        <strong>Returns:</strong>
393        <ul>
394            <li><code>void</code></li>
395        </ul>
396    </div>
397                </div>
398                        </div>
399        </td>
400        <td class="msource">Record</td>
401    </tr>
402        <tr class="method-row alt expandable">
403        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
404        <td class="sig">
405        <a id="Ext.data.Record-set"></a>
406            <b>set</b>(&nbsp;<code>String name</code>, <code>Object value</code>&nbsp;) : void            <div class="mdesc">
407                        <div class="short">Set the named field to the specified value.</div>
408            <div class="long">
409                Set the named field to the specified value.    <div class="mdetail-params">
410        <strong>Parameters:</strong>
411        <ul><li><code>name</code> : String<div class="sub-desc">The name of the field to set.</div></li><li><code>value</code> : Object<div class="sub-desc">The value to set the field to.</div></li>        </ul>
412        <strong>Returns:</strong>
413        <ul>
414            <li><code>void</code></li>
415        </ul>
416    </div>
417                </div>
418                        </div>
419        </td>
420        <td class="msource">Record</td>
421    </tr>
422            </table>
423                <a id="Ext.data.Record-events"></a>
424        <h2>Public Events</h2>
425        <div class="no-members">This class has no public events.</div>
426        </div>
Note: See TracBrowser for help on using the repository browser.