📄 ext.data.record.html.svn-base
字号:
<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> implementationthat 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 tothe 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> pathto 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 providedby the Reader into an object that will be stored in the Record. It is passed thefollowing parameters:<ul><li><b>v</b> : Mixed<p style="margin-left:1em">The data value as read by the Reader.</p></li><li><b>rec</b> : Mixed<p style="margin-left:1em">The data object containting the row as read by the Reader.Depending on Reader type, this could be an Array, an object, or an XML element.</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><li><b>defaultValue</b> : Mixed<p style="margin-left:1em">(Optional) The default value passed to the Reader when the field doesnot exist in the data object (i.e. undefined). (defaults to "")</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 definitionmay 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-isModified"></a>
<b>isModified</b>( <code>String fieldName</code> ) : Boolean <div class="mdesc">
<div class="short">Returns true if the field passed has been modified since the load or last commit.</div>
<div class="long">
Returns true if the field passed has been modified since the load or last commit. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>fieldName</code> : String<div class="sub-desc"></div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Boolean</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-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 notifiedof 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 alt 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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -