123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <div class="body-wrap">
- <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>
- <a class="inner-link" href="#Ext.data.Record-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
- <a class="inner-link" href="#Ext.data.Record-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
- <a class="bookmark" href="../docs/?class=Ext.data.Record"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
- </div>
- <h1>Class Ext.data.Record</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"><a href="../src/Record.js" target="_blank">Record.js</a></td></tr>
- <tr><td class="label">Class:</td><td class="hd-info">Record</td></tr>
- <tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr>
- </table>
- <div class="description">
- Instances of this class encapsulate both record <em>definition</em> information, and record
- <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
- to access Records cached in an <a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Ext.data.Store</a> object.<br>
- <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>.
- Instances 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
- objects.<br>
- <p>
- Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below. </div>
-
- <div class="hr"></div>
- <a id="Ext.data.Record-props"></a>
- <h2>Public Properties</h2>
- <table cellspacing="0" class="member-table">
- <tr>
- <th class="sig-header" colspan="2">Property</th>
- <th class="msource-header">Defined By</th>
- </tr>
- <tr class="property-row">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-data"></a>
- <b>data</b> : Object <div class="mdesc">
- The data for this record an object hash. </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="property-row alt">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-dirty"></a>
- <b>dirty</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">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-id"></a>
- <b>id</b> : Object <div class="mdesc">
-
- The unique ID of the record as specified at construction time. </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="property-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-modified"></a>
- <b>modified</b> : Object <div class="mdesc">
- <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>
- <div class="long">
- 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>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- </table>
- <a id="Ext.data.Record-methods"></a>
- <h2>Public Methods</h2>
- <table cellspacing="0" class="member-table">
- <tr>
- <th class="sig-header" colspan="2">Method</th>
- <th class="msource-header">Defined By</th>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-Record"></a>
- <b>Record</b>( <code>Array data</code>, <span class="optional" title="Optional">[<code>Object id</code>]</span> ) <div class="mdesc">
- <div class="short">This constructor should not be used to create Record objects. Instead, use the constructor generated by
- create. The p...</div>
- <div class="long">
- This constructor should not be used to create Record objects. Instead, use the constructor generated by
- <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">
- <strong>Parameters:</strong>
- <ul><li><code>data</code> : Array<div class="sub-desc">An associative Array of data values keyed by the field name.</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
- <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
- not specified an integer id is generated.</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code></code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-beginEdit"></a>
- <b>beginEdit</b>() : void <div class="mdesc">
- <div class="short">Begin an edit. While in edit mode, no events are relayed to the containing store.</div>
- <div class="long">
- Begin an edit. While in edit mode, no events are relayed to the containing store. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>void</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-cancelEdit"></a>
- <b>cancelEdit</b>() : 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><code>void</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-commit"></a>
- <b>commit</b>( <span class="optional" title="Optional">[<code>Boolean silent</code>]</span> ) : void <div class="mdesc">
- <div class="short">Usually called by the Ext.data.Store which owns the Record.
- Commits all changes made to the Record since either creat...</div>
- <div class="long">
- Usually called by the <a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Ext.data.Store</a> which owns the Record.
- Commits all changes made to the Record since either creation, or the last commit operation.
- <p>
- Developers 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
- of commit operations. <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 store of the change (defaults to false)</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>void</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-copy"></a>
- <b>copy</b>( <span class="optional" title="Optional">[<code>String id</code>]</span> ) : 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 if you don't want to use this record's id</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Record</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-create"></a>
- <b>create</b>( <span class="optional" title="Optional">[<code>Array o</code>]</span> ) : function <div class="mdesc">
- <div class="short"><static> Generate a constructor for a specific record layout.</div>
- <div class="long">
- <static> 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 field definition objects which specify field names, and optionally,
- data 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.
- Each field definition object may contain the following properties: <ul>
- <li><b>name</b> : String<p style="margin-left:1em">The name by which the field is referenced within the Record. This is referenced by,
- for 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></p></li>
- <li><b>mapping</b> : String<p style="margin-left:1em">(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
- that 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>
- is being used, then this is a string containing the javascript expression to reference the data relative to
- the 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
- to the data item relative to the record element. If the mapping expression is the same as the field name,
- this may be omitted.</p></li>
- <li><b>type</b> : String<p style="margin-left:1em">(Optional) The data type for conversion to displayable value. Possible values are
- <ul><li>auto (Default, implies no conversion)</li>
- <li>string</li>
- <li>int</li>
- <li>float</li>
- <li>boolean</li>
- <li>date</li></ul></p></li>
- <li><b>sortType</b> : Mixed<p style="margin-left:1em">(Optional) A member of <a ext:cls="Ext.data.SortTypes" href="output/Ext.data.SortTypes.html">Ext.data.SortTypes</a>.</p></li>
- <li><b>sortDir</b> : String<p style="margin-left:1em">(Optional) Initial direction to sort. "ASC" or "DESC"</p></li>
- <li><b>convert</b> : Function<p style="margin-left:1em">(Optional) A function which converts the value provided
- by the Reader into an object that will be stored in the Record. It is passed the
- following parameters:<ul>
- <li><b>v</b> : Mixed<p style="margin-left:1em">The data value as read by the Reader.</p></li>
- </ul></p></li>
- <li><b>dateFormat</b> : String<p style="margin-left:1em">(Optional) A format String for the Date.parseDate function.</p></li>
- </ul>
- <br>usage:<br><pre><code>var TopicRecord = Ext.data.Record.create([
- {name: <em>'title'</em>, mapping: <em>'topic_title'</em>},
- {name: <em>'author'</em>, mapping: <em>'username'</em>},
- {name: <em>'totalPosts'</em>, mapping: <em>'topic_replies'</em>, type: <em>'int'</em>},
- {name: <em>'lastPost'</em>, mapping: <em>'post_time'</em>, type: <em>'date'</em>},
- {name: <em>'lastPoster'</em>, mapping: <em>'user2'</em>},
- {name: <em>'excerpt'</em>, mapping: <em>'post_text'</em>}
- ]);
- <b>var</b> myNewRecord = <b>new</b> TopicRecord({
- title: <em>'Do my job please'</em>,
- author: <em>'noobie'</em>,
- totalPosts: 1,
- lastPost: <b>new</b> Date(),
- lastPoster: <em>'Animal'</em>,
- excerpt: <em>'No way dude!'</em>
- });
- myStore.add(myNewRecord);</code></pre>
- <p>In the simplest case, if no properties other than <tt>name</tt> are required, a field definition
- may consist of just a field name string.</p></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 to the definition.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-endEdit"></a>
- <b>endEdit</b>() : void <div class="mdesc">
- <div class="short">End an edit. If any data was modified, the containing store is notified.</div>
- <div class="long">
- End an edit. If any data was modified, the containing store is notified. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>void</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-get"></a>
- <b>get</b>( <code>String name</code> ) : Object <div class="mdesc">
- <div class="short">Get the value of the named field.</div>
- <div class="long">
- Get the value of the named field. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>name</code> : String<div class="sub-desc">The name of the field 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 class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-getChanges"></a>
- <b>getChanges</b>() : 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></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-reject"></a>
- <b>reject</b>( <span class="optional" title="Optional">[<code>Boolean silent</code>]</span> ) : void <div class="mdesc">
- <div class="short">Usually called by the Ext.data.Store which owns the Record.
- Rejects all changes made to the Record since either creat...</div>
- <div class="long">
- Usually called by the <a ext:cls="Ext.data.Store" href="output/Ext.data.Store.html">Ext.data.Store</a> which owns the Record.
- Rejects all changes made to the Record since either creation, or the last commit operation.
- Modified fields are reverted to their original values.
- <p>
- Developers 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
- of reject operations. <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 store of the change (defaults to false)</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>void</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.data.Record-set"></a>
- <b>set</b>( <code>String name</code>, <code>Object value</code> ) : void <div class="mdesc">
- <div class="short">Set the named field to the specified value.</div>
- <div class="long">
- Set the named field to the specified value. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <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>
- <strong>Returns:</strong>
- <ul>
- <li><code>void</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Record</td>
- </tr>
- </table>
- <a id="Ext.data.Record-events"></a>
- <h2>Public Events</h2>
- <div class="no-members">This class has no public events.</div>
- </div>
|