1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <meta http-equiv="content-type" content="text/html; charset=undefined" />
8 <meta name="generator" content="JsDoc Toolkit" />
11 <title>JsDoc Reference - Roo.data.Record</title>
14 <link rel="stylesheet" type="text/css" href="../../css/roojs.css" />
15 <link rel="stylesheet" type="text/css" href="../default.css" />
18 <script type="text/javascript" src="../page.js">
25 <body onload="RooDocsPage.onload();">
28 <div class="body-wrap">
30 <!-- ============================== links to methods. ================================= -->
32 <div class="top-tools">
34 <a class="inner-link" href="#Roo.data.Record-props"><img src="resources/s.gif" class="item-icon icon-prop">Properties</a>
35 <a class="inner-link" href="#Roo.data.Record-methods"><img src="resources/s.gif" class="item-icon icon-method">Methods</a>
36 <a class="inner-link" href="#Roo.data.Record-events"><img src="resources/s.gif" class="item-icon icon-event">Events</a>
37 <a class="inner-link" href="#Roo.data.Record-configs"><img src="resources/s.gif" class="item-icon icon-config">Config Options</a>
38 <a class="bookmark" href="NEED_TO_CREATE_DIRECT_LINK_HREF"><img src="resources/s.gif" class="item-icon icon-fav">Direct Link</a>
43 <!-- ============================== inheritance Block. ================================= -->
45 <!-- ============================== class title / details ============================ -->
48 <h1 class="classTitle">
53 <table cellspacing="0" class="class-summary-table">
55 <tr><td class="label">Package:</td><td class="hd-info">Roo.data</td></tr>
57 <tr><td class="label">Defined In:</td><td class="hd-info">
59 <a href="./src/Roo_data_Record.js.html">Roo/data/Record.js</a>.
62 <tr><td class="label">Class:</td><td class="hd-info">Record</td></tr>
70 <!-- ============================== class summary ========================== -->
71 <div class="description">
72 Instances of this class encapsulate both record <em>definition</em> information, and record<br/><em>value</em> information for use in {<b>link</b> Roo.data.Store} objects, or any code which needs<br/>to access Records cached in an {<b>link</b> Roo.data.Store} object.<br><br/><p><br/>Constructors for this class are generated by passing an Array of field definition objects to {<b>link</b> <b>create</b>}.<br/>Instances are usually only created by {<b>link</b> Roo.data.Reader} implementations when processing unformatted data<br/>objects.<br><br/><p><br/>Record objects generated by this constructor inherit all the methods of Roo.data.Record listed below.
76 <!-- ============================== Class comment block... ========================== -->
78 <div class="comments">
79 <b>Class Comments / Notes</B> =>
80 <u onclick="parent.CommentDialog.showCommentId = 'Roo.data.Record';">[Add Your comment/notes about this class]</u>
82 <iframe frameborder="0" id="comments-Roo.data" style="border: none;width:100%;"
83 src="/blog.php/GtkDjsComments/Roo.data.Record.html"></iframe>
88 <!-- ============================== config options ========================== -->
93 <div class="hr"></div>
94 <a id="Roo.data.Record-configs"></a>
98 <table cellspacing="0" class="member-table">
99 <caption class="Empty">Config Options - Has None</caption>
113 <!-- ============================== public properties ==================== -->
117 <a id="Roo.data.Record-props"></a>
123 <table cellspacing="0" class="member-table">
124 <caption class="Empty">Public Properties - Has None</caption>
130 <!-- ============================== methods summary / details ======================== -->
133 <a id="Roo.data.Record-methods"></a>
134 <!-- constructor?? -->
141 <!-- then dynamics first -->
148 <table cellspacing="0" class="member-table">
149 <caption>Public Methods</caption>
151 <th class="sig-header" colspan="2">Method</th>
152 <th class="msource-header">Defined By</th>
162 <tr class="method-row config-row-alt0 expandable notInherited">
163 <td class="micon"><a class="exi" href="#expand"> </a></td>
167 <a id="Roo.data-method-Record" name=".Record"></a>
168 <div class="fixedFont">
169 <span class="attributes">new <B>Roo.data.</B></span><b class="itemname">Record</b>
171 (<a href="./Array.html#constructor" roo:cls="Array.html#constructor">Array</a> <B><i>data</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>id</i></B>)
179 <div class="short">Create a new Roo.data.Record</div>
186 Create a new Roo.data.Record
189 <dl class="detailList">
190 <dt class="heading">Parameters:</dt>
193 <span class="fixedFont"><a href="./Array.html#constructor" roo:cls="Array.html#constructor">Array</a></span> <b>data</b>
196 <dd>An associative Array of data values keyed by the field name.</dd>
199 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>id</b>
202 <dd>(Optional) The id of the record. This id should be unique, and is used by the<br/>{<b>link</b> Roo.data.Store} object which owns the Record to index its collection of Records. If<br/>not specified an integer id is generated.</dd>
226 <tr class="method-row config-row-alt1 expandable notInherited">
227 <td class="micon"><a class="exi" href="#expand"> </a></td>
231 <a id="Roo.data.Record-method-create" name=".create"></a>
232 <div class="fixedFont">
233 <span class="attributes">Roo.data.Record.</span><b class="itemname">create</b>
235 (<a href="./Array.html#constructor" roo:cls="Array.html#constructor">Array</a> <B><i>o</i></B>)
242 <div class="short">Generate a constructor for a specific record layout.</div>
248 Generate a constructor for a specific record layout.
255 <dl class="detailList">
256 <dt class="heading">Parameters:</dt>
259 <span class="fixedFont"><a href="./Array.html#constructor" roo:cls="Array.html#constructor">Array</a></span> <b>o</b>
262 <dd>An Array of field definition objects which specify field names, and optionally,<br/>data types, and a mapping for an {<b>link</b> Roo.data.Reader} to extract the field's value from a data object.<br/>Each field definition object may contain the following properties: <ul><br/><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,<br/>for example the <em>dataIndex</em> property in column definition objects passed to {<b>link</b> Roo.grid.ColumnModel}</p></li><br/><li><b>mapping</b> : String<p style="margin-left:1em">(Optional) A path specification for use by the {<b>link</b> Roo.data.Reader} implementation<br/>that is creating the Record to access the data value from the data object. If an {<b>link</b> Roo.data.JsonReader}<br/>is being used, then this is a string containing the javascript expression to reference the data relative to <br/>the record item's root. If an {<b>link</b> Roo.data.XmlReader} is being used, this is an {<b>link</b> Roo.DomQuery} path<br/>to the data item relative to the record element. If the mapping expression is the same as the field name,<br/>this may be omitted.</p></li><br/><li><b>type</b> : String<p style="margin-left:1em">(Optional) The data type for conversion to displayable value. Possible values are<br/><ul><li>auto (Default, implies no conversion)</li><br/><li>string</li><br/><li>int</li><br/><li>float</li><br/><li>boolean</li><br/><li>date</li></ul></p></li><br/><li><b>sortType</b> : Mixed<p style="margin-left:1em">(Optional) A member of {<b>link</b> Roo.data.SortTypes}.</p></li><br/><li><b>sortDir</b> : String<p style="margin-left:1em">(Optional) Initial direction to sort. "ASC" or "DESC"</p></li><br/><li><b>convert</b> : Function<p style="margin-left:1em">(Optional) A function which converts the value provided<br/>by the Reader into an object that will be stored in the Record. It is passed the<br/>following parameters:<ul><br/><li><b>v</b> : Mixed<p style="margin-left:1em">The data value as read by the Reader.</p></li><br/></ul></p></li><br/><li><b>dateFormat</b> : String<p style="margin-left:1em">(Optional) A format String for the Date.parseDate function.</p></li><br/></ul><br/><br>usage:<br><pre><code><br/>var TopicRecord = Roo.data.Record.create(<br/> {name: 'title', mapping: 'topic_title'},<br/> {name: 'author', mapping: 'username'},<br/> {name: 'totalPosts', mapping: 'topic_replies', type: 'int'},<br/> {name: 'lastPost', mapping: 'post_time', type: 'date'},<br/> {name: 'lastPoster', mapping: 'user2'},<br/> {name: 'excerpt', mapping: 'post_text'}<br/>);<br/><br/>var myNewRecord = new TopicRecord({<br/> title: 'Do my job please',<br/> author: 'noobie',<br/> totalPosts: 1,<br/> lastPost: new Date(),<br/> lastPoster: 'Animal',<br/> excerpt: 'No way dude!'<br/>});<br/>myStore.add(myNewRecord);<br/></code></pre></dd>
288 <tr class="method-row config-row-alt0 expandable notInherited">
289 <td class="micon"><a class="exi" href="#expand"> </a></td>
293 <a id="Roo.data.Record-method-commit" name=".commit"></a>
294 <div class="fixedFont">
295 <span class="attributes"></span><b class="itemname">commit</b>
304 <div class="short">Usually called by the {<b>link</b> Roo.data.Store} which owns the Record.</div>
310 Usually called by the {<b>link</b> Roo.data.Store} which owns the Record.<br/>Commits all changes made to the Record since either creation, or the last commit operation.<br/><p><br/>Developers should subscribe to the {<b>link</b> Roo.data.Store<b>update</b>} event to have their code notified<br/>of commit operations.
339 <tr class="method-row config-row-alt1 expandable notInherited">
340 <td class="micon"><a class="exi" href="#expand"> </a></td>
344 <a id="Roo.data.Record-method-copy" name=".copy"></a>
345 <div class="fixedFont">
346 <span class="attributes"></span><b class="itemname">copy</b>
348 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a> <B><i>id</i></B>)
363 <div class="short">Creates a copy of this record.</div>
369 Creates a copy of this record.
376 <dl class="detailList">
377 <dt class="heading">Parameters:</dt>
380 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> <b>id</b>
383 <dd>(optional) A new record id if you don't want to use this record's id</dd>
391 <dl class="detailList">
392 <dt class="heading">Returns:</dt>
394 <dd><span class="fixedFont">Record</span> </dd>
416 <tr class="method-row config-row-alt0 expandable notInherited">
417 <td class="micon"><a class="exi" href="#expand"> </a></td>
421 <a id="Roo.data.Record-method-get" name=".get"></a>
422 <div class="fixedFont">
423 <span class="attributes"></span><b class="itemname">get</b>
425 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a> <B><i>name</i></B>)
431 <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a>
440 <div class="short">Get the value of the named field.</div>
446 Get the value of the named field.
453 <dl class="detailList">
454 <dt class="heading">Parameters:</dt>
457 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> <b>name</b>
460 <dd>The name of the field to get the value of.</dd>
468 <dl class="detailList">
469 <dt class="heading">Returns:</dt>
471 <dd><span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> The value of the field.</dd>
493 <tr class="method-row config-row-alt1 expandable notInherited">
494 <td class="micon"><a class="exi" href="#expand"> </a></td>
498 <a id="Roo.data.Record-method-reject" name=".reject"></a>
499 <div class="fixedFont">
500 <span class="attributes"></span><b class="itemname">reject</b>
509 <div class="short">Usually called by the {<b>link</b> Roo.data.Store} which owns the Record.</div>
515 Usually called by the {<b>link</b> Roo.data.Store} which owns the Record.<br/>Rejects all changes made to the Record since either creation, or the last commit operation.<br/>Modified fields are reverted to their original values.<br/><p><br/>Developers should subscribe to the {<b>link</b> Roo.data.Store<b>update</b>} event to have their code notified<br/>of reject operations.
544 <tr class="method-row config-row-alt0 expandable notInherited">
545 <td class="micon"><a class="exi" href="#expand"> </a></td>
549 <a id="Roo.data.Record-method-set" name=".set"></a>
550 <div class="fixedFont">
551 <span class="attributes"></span><b class="itemname">set</b>
553 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a> <B><i>name</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>value</i></B>)
560 <div class="short">Set the named field to the specified value.</div>
566 Set the named field to the specified value.
573 <dl class="detailList">
574 <dt class="heading">Parameters:</dt>
577 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> <b>name</b>
580 <dd>The name of the field to set.</dd>
583 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>value</b>
586 <dd>The value to set the field to.</dd>
615 <!-- ============================== events summary / details ======================== -->
618 <a id="Roo.data.Record-events"></a>
624 <table cellspacing="0" class="member-table">
625 <caption class="Empty">Events - Has None</caption>
636 <!-- ============================== footer ================================= -->
637 <div class="fineprint" style="clear:both">
639 Documentation generated by <a href="http://www.akbkhome.com" target="_blankt">Introspection Doc Generator</a> on Wed Apr 02 2014 13:19:52 GMT+0800 (HKT)
641 <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a>