sync
[roojs1] / docs / symbols / Roo.data.Record.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
3
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
6         <head>
7                 <meta http-equiv="content-type" content="text/html; charset=undefined" />
8                 <meta name="generator" content="JsDoc Toolkit" />
9                 
10                 
11                 <title>JsDoc Reference - Roo.data.Record</title>
12                 
13                 
14         <link rel="stylesheet" type="text/css" href="../../css/roojs.css" />            
15         <link rel="stylesheet" type="text/css" href="../default.css" />
16         
17         
18         <script type="text/javascript" src="../page.js">
19         
20         </script>
21          
22                 
23         </head>
24
25         <body onload="RooDocsPage.onload();">
26          
27         
28 <div class="body-wrap">
29
30     <!-- ============================== links to methods. ================================= --> 
31
32     <div class="top-tools">
33     <!--
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>
39         -->
40     </div>
41
42     
43 <!-- ============================== inheritance Block. ================================= -->    
44         
45 <!-- ============================== class title / details ============================ -->
46     
47     
48     <h1 class="classTitle">
49                                 
50                                 Class Roo.data.Record
51                         </h1>
52                         
53     <table cellspacing="0" class="class-summary-table">
54         
55                 <tr><td class="label">Package:</td><td class="hd-info">Roo.data</td></tr>
56         
57         <tr><td class="label">Defined In:</td><td class="hd-info">
58                         
59                                         <a href="./src/Roo_data_Record.js.html">Roo/data/Record.js</a>.
60                         
61         </td></tr>
62         <tr><td class="label">Class:</td><td class="hd-info">Record</td></tr>
63         
64         
65         
66         
67     </table>
68
69     
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.
73     </div>
74
75         
76 <!-- ============================== Class comment block... ========================== -->                                       
77
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>
81         <br/>
82         <iframe frameborder="0"  id="comments-Roo.data" style="border: none;width:100%;" 
83                 src="/blog.php/GtkDjsComments/Roo.data.Record.html"></iframe>
84 </div>
85         
86
87                 
88 <!-- ============================== config options ========================== -->                                               
89                  
90     
91     
92                 
93     <div class="hr"></div>
94     <a id="Roo.data.Record-configs"></a>
95                 
96     
97     
98      <table cellspacing="0" class="member-table">
99       <caption class="Empty">Config Options - Has None</caption>
100      </table>
101     
102     
103      
104                 
105   
106   
107   
108   
109   
110   
111   
112   
113   <!-- ============================== public properties ==================== -->        
114   
115   
116   
117     <a id="Roo.data.Record-props"></a>      
118     
119     
120
121     
122     
123      <table cellspacing="0" class="member-table">
124       <caption class="Empty">Public Properties - Has None</caption>
125      </table>
126     
127     
128      
129     
130   <!-- ============================== methods summary / details ======================== -->
131   
132   
133   <a id="Roo.data.Record-methods"></a>
134         <!-- constructor?? -->
135         
136         <!-- static's first 
137         
138         
139         -->
140         
141         <!-- then dynamics first -->
142         
143   
144   
145     
146     
147     
148       <table cellspacing="0" class="member-table">
149       <caption>Public Methods</caption>
150         <tr>
151             <th class="sig-header" colspan="2">Method</th>            
152             <th class="msource-header">Defined By</th>
153
154         </tr>
155         
156         
157         
158          
159         
160         
161           
162           <tr class="method-row config-row-alt0 expandable notInherited">
163             <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
164            
165            
166             <td class="sig">
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>
170                                 
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>) 
172                         
173                                 
174                         
175                 </div>
176                 <div class="mdesc">
177                 
178                  
179                         <div class="short">Create a new Roo.data.Record</div> 
180                  
181                  
182                     <div class="long">
183                         
184                         
185                         
186                                 Create a new Roo.data.Record
187                         
188                         
189                                 <dl class="detailList">
190                                 <dt class="heading">Parameters:</dt>
191                                 
192                                         <dt>
193                                                 <span class="fixedFont"><a href="./Array.html#constructor" roo:cls="Array.html#constructor">Array</a></span>  <b>data</b>
194                                                 
195                                         </dt>
196                                         <dd>An associative Array of data values keyed by the field name.</dd>
197                                 
198                                         <dt>
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>
200                                                 
201                                         </dt>
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>
203                                 
204                                 </dl>
205                         
206                         
207                         
208                         
209                         
210                         
211                         
212
213                     
214                     
215                      
216                     </div>                    
217                 </div>
218
219             </td>
220             <td class="msource">
221                 &nbsp;
222             </td>
223         </tr>
224         
225           
226           <tr class="method-row config-row-alt1 expandable notInherited">
227             <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
228            
229            
230             <td class="sig">
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>
234                                 
235                                  (<a href="./Array.html#constructor" roo:cls="Array.html#constructor">Array</a> <B><i>o</i></B>) 
236                         
237                                 
238                         
239                 </div>
240                 <div class="mdesc">
241                 
242                    <div class="short">Generate a constructor for a specific record layout.</div> 
243                  
244                  
245                  
246                     <div class="long">
247                         
248                                 Generate a constructor for a specific record layout.
249                     
250                                 
251                         
252                         
253                         
254                         
255                                 <dl class="detailList">
256                                 <dt class="heading">Parameters:</dt>
257                                 
258                                         <dt>
259                                                 <span class="fixedFont"><a href="./Array.html#constructor" roo:cls="Array.html#constructor">Array</a></span>  <b>o</b>
260                                                 
261                                         </dt>
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>
263                                 
264                                 </dl>
265                         
266                         
267                         
268                         
269                         
270                         
271                         
272
273                     
274                     
275                      
276                     </div>                    
277                 </div>
278
279             </td>
280             <td class="msource">
281                 
282                         Roo.data.Record
283                 &nbsp;
284             </td>
285         </tr>
286         
287           
288           <tr class="method-row config-row-alt0 expandable notInherited">
289             <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
290            
291            
292             <td class="sig">
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>
296                                 
297                                  () 
298                         
299                                 
300                         
301                 </div>
302                 <div class="mdesc">
303                 
304                    <div class="short">Usually called by the {<b>link</b> Roo.data.Store} which owns the Record.</div> 
305                  
306                  
307                  
308                     <div class="long">
309                         
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.
311                     
312                                 
313                         
314                         
315                         
316                         
317                         
318                         
319                         
320                         
321                         
322                         
323
324                     
325                     
326                      
327                     </div>                    
328                 </div>
329
330             </td>
331             <td class="msource">
332                 
333                         Roo.data.Record
334                 &nbsp;
335             </td>
336         </tr>
337         
338           
339           <tr class="method-row config-row-alt1 expandable notInherited">
340             <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
341            
342            
343             <td class="sig">
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>
347                                 
348                                  (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a> <B><i>id</i></B>) 
349                         
350                                 
351                                          : 
352                                         
353                                                 
354                                                 Record
355                                         
356                                         
357                                         
358                                 
359                         
360                 </div>
361                 <div class="mdesc">
362                 
363                    <div class="short">Creates a copy of this record.</div> 
364                  
365                  
366                  
367                     <div class="long">
368                         
369                                 Creates a copy of this record.
370                     
371                                 
372                         
373                         
374                         
375                         
376                                 <dl class="detailList">
377                                 <dt class="heading">Parameters:</dt>
378                                 
379                                         <dt>
380                                                 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span>  <b>id</b>
381                                                 
382                                         </dt>
383                                         <dd>(optional) A new record id if you don't want to use this record's id</dd>
384                                 
385                                 </dl>
386                         
387                         
388                         
389                         
390                         
391                                 <dl class="detailList">
392                                 <dt class="heading">Returns:</dt>
393                                 
394                                         <dd><span class="fixedFont">Record</span>  </dd>
395                                 
396                                 </dl>
397                         
398                         
399                         
400
401                     
402                     
403                      
404                     </div>                    
405                 </div>
406
407             </td>
408             <td class="msource">
409                 
410                         Roo.data.Record
411                 &nbsp;
412             </td>
413         </tr>
414         
415           
416           <tr class="method-row config-row-alt0 expandable notInherited">
417             <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
418            
419            
420             <td class="sig">
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>
424                                 
425                                  (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a> <B><i>name</i></B>) 
426                         
427                                 
428                                          : 
429                                         
430                                                 
431                                                 <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a>
432                                         
433                                         
434                                         
435                                 
436                         
437                 </div>
438                 <div class="mdesc">
439                 
440                    <div class="short">Get the value of the named field.</div> 
441                  
442                  
443                  
444                     <div class="long">
445                         
446                                 Get the value of the named field.
447                     
448                                 
449                         
450                         
451                         
452                         
453                                 <dl class="detailList">
454                                 <dt class="heading">Parameters:</dt>
455                                 
456                                         <dt>
457                                                 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span>  <b>name</b>
458                                                 
459                                         </dt>
460                                         <dd>The name of the field to get the value of.</dd>
461                                 
462                                 </dl>
463                         
464                         
465                         
466                         
467                         
468                                 <dl class="detailList">
469                                 <dt class="heading">Returns:</dt>
470                                 
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>
472                                 
473                                 </dl>
474                         
475                         
476                         
477
478                     
479                     
480                      
481                     </div>                    
482                 </div>
483
484             </td>
485             <td class="msource">
486                 
487                         Roo.data.Record
488                 &nbsp;
489             </td>
490         </tr>
491         
492           
493           <tr class="method-row config-row-alt1 expandable notInherited">
494             <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
495            
496            
497             <td class="sig">
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>
501                                 
502                                  () 
503                         
504                                 
505                         
506                 </div>
507                 <div class="mdesc">
508                 
509                    <div class="short">Usually called by the {<b>link</b> Roo.data.Store} which owns the Record.</div> 
510                  
511                  
512                  
513                     <div class="long">
514                         
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.
516                     
517                                 
518                         
519                         
520                         
521                         
522                         
523                         
524                         
525                         
526                         
527                         
528
529                     
530                     
531                      
532                     </div>                    
533                 </div>
534
535             </td>
536             <td class="msource">
537                 
538                         Roo.data.Record
539                 &nbsp;
540             </td>
541         </tr>
542         
543           
544           <tr class="method-row config-row-alt0 expandable notInherited">
545             <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
546            
547            
548             <td class="sig">
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>
552                                 
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>) 
554                         
555                                 
556                         
557                 </div>
558                 <div class="mdesc">
559                 
560                    <div class="short">Set the named field to the specified value.</div> 
561                  
562                  
563                  
564                     <div class="long">
565                         
566                                 Set the named field to the specified value.
567                     
568                                 
569                         
570                         
571                         
572                         
573                                 <dl class="detailList">
574                                 <dt class="heading">Parameters:</dt>
575                                 
576                                         <dt>
577                                                 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span>  <b>name</b>
578                                                 
579                                         </dt>
580                                         <dd>The name of the field to set.</dd>
581                                 
582                                         <dt>
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>
584                                                 
585                                         </dt>
586                                         <dd>The value to set the field to.</dd>
587                                 
588                                 </dl>
589                         
590                         
591                         
592                         
593                         
594                         
595                         
596
597                     
598                     
599                      
600                     </div>                    
601                 </div>
602
603             </td>
604             <td class="msource">
605                 
606                         Roo.data.Record
607                 &nbsp;
608             </td>
609         </tr>
610         
611                                                        
612     </table>
613
614   
615   <!-- ============================== events summary / details ======================== -->
616   
617   
618   <a id="Roo.data.Record-events"></a>
619     
620   
621         
622    
623     
624      <table cellspacing="0" class="member-table">
625       <caption class="Empty">Events - Has None</caption>
626      </table>
627     
628     
629   
630     
631     
632   
633   
634   
635  
636 <!-- ============================== footer ================================= -->
637                 <div class="fineprint" style="clear:both">
638                         
639                         Documentation generated by <a href="http://www.akbkhome.com" target="_blankt">Introspection Doc Generator</a>  on Tue Jul 27 2010 11:05:07 GMT+0800 (HKT)
640                         Based on 
641                         <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a>  
642                 </div>
643         </body>
644 </html>