sync
[roojs1] / docs / symbols / Roo.data.Record.json
1 {
2   "name" : "Roo.data.Record",
3   "augments" : [],
4   "childClasses" : [],
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   "throws" : "",
30   "requires" : "",
31   "config" : [],
32   "methods" : [
33     {
34       "name" : "copy",
35       "type" : "function",
36       "desc" : "Creates a copy of this record.",
37       "sig" : "(id)",
38       "static" : false,
39       "memberOf" : "",
40       "isStatic" : false,
41       "isConstructor" : false,
42       "isPrivate" : false,
43       "example" : "",
44       "deprecated" : "",
45       "since" : "",
46       "see" : "",
47       "exceptions" : "",
48       "requires" : "",
49       "params" : [
50         {
51           "name" : "id",
52           "type" : "String",
53           "desc" : "(optional) A new record id if you don't want to use this record's id",
54           "isOptional" : false
55         }
56       ],
57       "returns" : [
58         {
59           "name" : "",
60           "type" : "Record",
61           "desc" : ""
62         }
63       ]
64     },
65     {
66       "name" : "commit",
67       "type" : "function",
68       "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.",
69       "sig" : "()\n{\n\n}",
70       "static" : false,
71       "memberOf" : "",
72       "isStatic" : false,
73       "isConstructor" : false,
74       "isPrivate" : false,
75       "example" : "",
76       "deprecated" : "",
77       "since" : "",
78       "see" : "",
79       "exceptions" : "",
80       "requires" : "",
81       "params" : [],
82       "returns" : []
83     },
84     {
85       "name" : "get",
86       "type" : "function",
87       "desc" : "Get the value of the named field.",
88       "sig" : "(name)",
89       "static" : false,
90       "memberOf" : "",
91       "isStatic" : false,
92       "isConstructor" : false,
93       "isPrivate" : false,
94       "example" : "",
95       "deprecated" : "",
96       "since" : "",
97       "see" : "",
98       "exceptions" : "",
99       "requires" : "",
100       "params" : [
101         {
102           "name" : "name",
103           "type" : "String",
104           "desc" : "The name of the field to get the value of.",
105           "isOptional" : false
106         }
107       ],
108       "returns" : [
109         {
110           "name" : "",
111           "type" : "Object",
112           "desc" : "The value of the field."
113         }
114       ]
115     },
116     {
117       "name" : "set",
118       "type" : "function",
119       "desc" : "Set the named field to the specified value.",
120       "sig" : "(name, value)",
121       "static" : false,
122       "memberOf" : "",
123       "isStatic" : false,
124       "isConstructor" : false,
125       "isPrivate" : false,
126       "example" : "",
127       "deprecated" : "",
128       "since" : "",
129       "see" : "",
130       "exceptions" : "",
131       "requires" : "",
132       "params" : [
133         {
134           "name" : "name",
135           "type" : "String",
136           "desc" : "The name of the field to set.",
137           "isOptional" : false
138         },
139         {
140           "name" : "value",
141           "type" : "Object",
142           "desc" : "The value to set the field to.",
143           "isOptional" : false
144         }
145       ],
146       "returns" : []
147     },
148     {
149       "name" : "reject",
150       "type" : "function",
151       "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.",
152       "sig" : "()\n{\n\n}",
153       "static" : false,
154       "memberOf" : "",
155       "isStatic" : false,
156       "isConstructor" : false,
157       "isPrivate" : false,
158       "example" : "",
159       "deprecated" : "",
160       "since" : "",
161       "see" : "",
162       "exceptions" : "",
163       "requires" : "",
164       "params" : [],
165       "returns" : []
166     },
167     {
168       "name" : "create",
169       "type" : "function",
170       "desc" : "Generate a constructor for a specific record layout.",
171       "sig" : "(o)",
172       "static" : true,
173       "memberOf" : "",
174       "isStatic" : true,
175       "isConstructor" : false,
176       "isPrivate" : false,
177       "example" : "",
178       "deprecated" : "",
179       "since" : "",
180       "see" : "",
181       "exceptions" : "",
182       "requires" : "",
183       "params" : [
184         {
185           "name" : "o",
186           "type" : "Array",
187           "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>",
188           "isOptional" : false
189         }
190       ],
191       "returns" : []
192     }
193   ],
194   "events" : []
195 }