de1d6de582d7ea6abbf5d113b934b1bf26906bff
[roojs1] / docs / symbols / Roo.data.Record.json
1 {
2   "name" : "Roo.data.Record",
3   "augments" : [
4   ],
5   "desc" : "Instances of this class encapsulate both record <em>definition</em> information, and record\n<em>value</em> information for use in {@link Roo.data.Store} objects, or any code which needs\nto access Records cached in an {@link Roo.data.Store} object.<br>\n<p>\nConstructors for this class are generated by passing an Array of field definition objects to {@link #create}.\nInstances are usually only created by {@link Roo.data.Reader} implementations when processing unformatted data\nobjects.<br>\n<p>\nRecord objects generated by this constructor inherit all the methods of Roo.data.Record listed below.",
6   "isSingleton" : false,
7   "isStatic" : false,
8   "isBuiltin" : false,
9   "memberOf" : "Record",
10   "example" : "",
11   "deprecated" : "",
12   "since" : "",
13   "see" : "",
14   "params" : [
15     {
16       "name" : "data",
17       "type" : "Array",
18       "desc" : "An associative Array of data values keyed by the field name.",
19       "isOptional" : false
20     },
21     {
22       "name" : "id",
23       "type" : "Object",
24       "desc" : "(Optional) The id of the record. This id should be unique, and is used by the\n{@link Roo.data.Store} object which owns the Record to index its collection of Records. If\nnot specified an integer id is generated.",
25       "isOptional" : false
26     }
27   ],
28   "returns" : [
29   ],
30   "config" : [
31   ],
32   "methods" : [
33     {
34       "name" : "copy",
35       "desc" : "Creates a copy of this record.",
36       "isStatic" : false,
37       "isConstructor" : false,
38       "isPrivate" : false,
39       "memberOf" : "Roo.data.Record",
40       "example" : "",
41       "deprecated" : "",
42       "since" : "",
43       "see" : "",
44       "params" : [
45         {
46           "name" : "id",
47           "type" : "String",
48           "desc" : "(optional) A new record id if you don't want to use this record's id",
49           "isOptional" : false
50         }
51       ],
52       "returns" : [
53         {
54           "name" : "",
55           "type" : "Record",
56           "desc" : ""
57         }
58       ]
59     },
60     {
61       "name" : "commit",
62       "desc" : "Usually called by the {@link Roo.data.Store} which owns the Record.\nCommits all changes made to the Record since either creation, or the last commit operation.\n<p>\nDevelopers should subscribe to the {@link Roo.data.Store#update} event to have their code notified\nof commit operations.",
63       "isStatic" : false,
64       "isConstructor" : false,
65       "isPrivate" : false,
66       "memberOf" : "Roo.data.Record",
67       "example" : "",
68       "deprecated" : "",
69       "since" : "",
70       "see" : "",
71       "params" : [
72       ],
73       "returns" : [
74       ]
75     },
76     {
77       "name" : "get",
78       "desc" : "Get the value of the named field.",
79       "isStatic" : false,
80       "isConstructor" : false,
81       "isPrivate" : false,
82       "memberOf" : "Roo.data.Record",
83       "example" : "",
84       "deprecated" : "",
85       "since" : "",
86       "see" : "",
87       "params" : [
88         {
89           "name" : "name",
90           "type" : "String",
91           "desc" : "The name of the field to get the value of.",
92           "isOptional" : false
93         }
94       ],
95       "returns" : [
96         {
97           "name" : "",
98           "type" : "Object",
99           "desc" : "The value of the field."
100         }
101       ]
102     },
103     {
104       "name" : "set",
105       "desc" : "Set the named field to the specified value.",
106       "isStatic" : false,
107       "isConstructor" : false,
108       "isPrivate" : false,
109       "memberOf" : "Roo.data.Record",
110       "example" : "",
111       "deprecated" : "",
112       "since" : "",
113       "see" : "",
114       "params" : [
115         {
116           "name" : "name",
117           "type" : "String",
118           "desc" : "The name of the field to set.",
119           "isOptional" : false
120         },
121         {
122           "name" : "value",
123           "type" : "Object",
124           "desc" : "The value to set the field to.",
125           "isOptional" : false
126         }
127       ],
128       "returns" : [
129       ]
130     },
131     {
132       "name" : "reject",
133       "desc" : "Usually called by the {@link Roo.data.Store} which owns the Record.\nRejects all changes made to the Record since either creation, or the last commit operation.\nModified fields are reverted to their original values.\n<p>\nDevelopers should subscribe to the {@link Roo.data.Store#update} event to have their code notified\nof reject operations.",
134       "isStatic" : false,
135       "isConstructor" : false,
136       "isPrivate" : false,
137       "memberOf" : "Roo.data.Record",
138       "example" : "",
139       "deprecated" : "",
140       "since" : "",
141       "see" : "",
142       "params" : [
143       ],
144       "returns" : [
145       ]
146     },
147     {
148       "name" : "create",
149       "desc" : "Generate a constructor for a specific record layout.",
150       "isStatic" : true,
151       "isConstructor" : false,
152       "isPrivate" : false,
153       "memberOf" : "Roo.data.Record",
154       "example" : "",
155       "deprecated" : "",
156       "since" : "",
157       "see" : "",
158       "params" : [
159         {
160           "name" : "o",
161           "type" : "Array",
162           "desc" : "An Array of field definition objects which specify field names, and optionally,\ndata types, and a mapping for an {@link Roo.data.Reader} to extract the field's value from a data object.\nEach field definition object may contain the following properties: <ul>\n<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,\nfor example the <em>dataIndex</em> property in column definition objects passed to {@link Roo.grid.ColumnModel}</p></li>\n<li><b>mapping</b> : String<p style=\"margin-left:1em\">(Optional) A path specification for use by the {@link Roo.data.Reader} implementation\nthat is creating the Record to access the data value from the data object. If an {@link Roo.data.JsonReader}\nis being used, then this is a string containing the javascript expression to reference the data relative to \nthe record item's root. If an {@link Roo.data.XmlReader} is being used, this is an {@link Roo.DomQuery} path\nto the data item relative to the record element. If the mapping expression is the same as the field name,\nthis may be omitted.</p></li>\n<li><b>type</b> : String<p style=\"margin-left:1em\">(Optional) The data type for conversion to displayable value. Possible values are\n<ul><li>auto (Default, implies no conversion)</li>\n<li>string</li>\n<li>int</li>\n<li>float</li>\n<li>boolean</li>\n<li>date</li></ul></p></li>\n<li><b>sortType</b> : Mixed<p style=\"margin-left:1em\">(Optional) A member of {@link Roo.data.SortTypes}.</p></li>\n<li><b>sortDir</b> : String<p style=\"margin-left:1em\">(Optional) Initial direction to sort. \"ASC\" or \"DESC\"</p></li>\n<li><b>convert</b> : Function<p style=\"margin-left:1em\">(Optional) A function which converts the value provided\nby the Reader into an object that will be stored in the Record. It is passed the\nfollowing parameters:<ul>\n<li><b>v</b> : Mixed<p style=\"margin-left:1em\">The data value as read by the Reader.</p></li>\n</ul></p></li>\n<li><b>dateFormat</b> : String<p style=\"margin-left:1em\">(Optional) A format String for the Date.parseDate function.</p></li>\n</ul>\n<br>usage:<br><pre><code>\nvar TopicRecord = Roo.data.Record.create(\n    {name: 'title', mapping: 'topic_title'},\n    {name: 'author', mapping: 'username'},\n    {name: 'totalPosts', mapping: 'topic_replies', type: 'int'},\n    {name: 'lastPost', mapping: 'post_time', type: 'date'},\n    {name: 'lastPoster', mapping: 'user2'},\n    {name: 'excerpt', mapping: 'post_text'}\n);\n\nvar myNewRecord = new TopicRecord({\n    title: 'Do my job please',\n    author: 'noobie',\n    totalPosts: 1,\n    lastPost: new Date(),\n    lastPoster: 'Animal',\n    excerpt: 'No way dude!'\n});\nmyStore.add(myNewRecord);\n</code></pre>",
163           "isOptional" : false
164         }
165       ],
166       "returns" : [
167       ]
168     }
169   ],
170   "events" : [
171   ]
172 }