Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / output / Ext.Object.js
1 Ext.data.JsonP.Ext_Object({
2   "tagname": "class",
3   "name": "Ext.Object",
4   "doc": "<p>A collection of useful static methods to deal with objects</p>\n",
5   "extends": null,
6   "mixins": [
7
8   ],
9   "alternateClassNames": [
10
11   ],
12   "xtype": null,
13   "author": "Jacky Nguyen <jacky@sencha.com>",
14   "docauthor": "Jacky Nguyen <jacky@sencha.com>",
15   "singleton": true,
16   "private": false,
17   "cfg": [
18
19   ],
20   "method": [
21     {
22       "tagname": "method",
23       "name": "each",
24       "member": "Ext.Object",
25       "doc": "<p>Iterate through an object and invoke the given callback function for each iteration. The iteration can be stop\nby returning <code>false</code> in the callback function. For example:</p>\n\n<pre><code>var person = {\n    name: 'Jacky'\n    hairColor: 'black'\n    loves: ['food', 'sleeping', 'wife']\n};\n\nExt.Object.each(person, function(key, value, myself) {\n    console.log(key + \":\" + value);\n\n    if (key === 'hairColor') {\n        return false; // stop the iteration\n    }\n});\n</code></pre>\n",
26       "params": [
27         {
28           "type": "Object",
29           "name": "object",
30           "doc": "<p>The object to iterate</p>\n",
31           "optional": false
32         },
33         {
34           "type": "Function",
35           "name": "fn",
36           "doc": "<p>The callback function. Passed arguments for each iteration are:</p>\n\n<ul>\n<li>{String} <code>key</code></li>\n<li>{Mixed} <code>value</code></li>\n<li>{Object} <code>object</code> The object itself</li>\n</ul>\n\n",
37           "optional": false
38         },
39         {
40           "type": "Object",
41           "name": "scope",
42           "doc": "<p>(Optional) The execution scope (<code>this</code>) of the callback function</p>\n",
43           "optional": false
44         }
45       ],
46       "return": {
47         "type": "void",
48         "doc": "\n"
49       },
50       "private": false,
51       "static": false,
52       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
53       "linenr": 275,
54       "html_filename": "Object.html",
55       "href": "Object.html#Ext-Object-method-each",
56       "shortDoc": "Iterate through an object and invoke the given callback function for each iteration. The iteration can be stop\nby ret..."
57     },
58     {
59       "tagname": "method",
60       "name": "fromQueryString",
61       "member": "Ext.Object",
62       "doc": "<p>Converts a query string back into an object.</p>\n\n<ul>\n<li><p>Non-recursive:</p>\n\n<p>  Ext.Object.fromQueryString(foo=1&amp;bar=2); // returns {foo: 1, bar: 2}\n  Ext.Object.fromQueryString(foo=&amp;bar=2); // returns {foo: null, bar: 2}\n  Ext.Object.fromQueryString(some%20price=%24300); // returns {'some price': '$300'}\n  Ext.Object.fromQueryString(colors=red&amp;colors=green&amp;colors=blue); // returns {colors: ['red', 'green', 'blue']}</p></li>\n<li><p>Recursive:</p>\n\n<p>  Ext.Object.fromQueryString(\"username=Jacky&amp;dateOfBirth[day]=1&amp;dateOfBirth[month]=2&amp;dateOfBirth[year]=1911&amp;hobbies[0]=coding&amp;hobbies[1]=eating&amp;hobbies[2]=sleeping&amp;hobbies[3][0]=nested&amp;hobbies[3][1]=stuff\", true);</p>\n\n<p>  // returns\n  {</p>\n\n<pre><code>  username: 'Jacky',\n  dateOfBirth: {\n      day: '1',\n      month: '2',\n      year: '1911'\n  },\n  hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']]\n</code></pre>\n\n<p>  }</p></li>\n</ul>\n\n",
63       "params": [
64         {
65           "type": "String",
66           "name": "queryString",
67           "doc": "<p>The query string to decode</p>\n",
68           "optional": false
69         },
70         {
71           "type": "Boolean",
72           "name": "recursive",
73           "doc": "<p>(Optional) Whether or not to recursively decode the string. This format is supported by\nPHP / Ruby on Rails servers and similar. Defaults to false</p>\n",
74           "optional": false
75         }
76       ],
77       "return": {
78         "type": "Object",
79         "doc": "\n"
80       },
81       "private": false,
82       "static": false,
83       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
84       "linenr": 156,
85       "html_filename": "Object.html",
86       "href": "Object.html#Ext-Object-method-fromQueryString",
87       "shortDoc": "Converts a query string back into an object.\n\n\nNon-recursive:\n\n  Ext.Object.fromQueryString(foo=1&amp;bar=2); // retu..."
88     },
89     {
90       "tagname": "method",
91       "name": "getKey",
92       "member": "Ext.Object",
93       "doc": "<p>Returns the first matching key corresponding to the given value.\nIf no matching value is found, null is returned.</p>\n\n<pre><code>var person = {\n    name: 'Jacky',\n    loves: 'food'\n};\n\nalert(Ext.Object.getKey(sencha, 'loves')); // alerts 'food'\n</code></pre>\n",
94       "params": [
95         {
96           "type": "Object",
97           "name": "object",
98           "doc": "\n",
99           "optional": false
100         },
101         {
102           "type": "Object",
103           "name": "value",
104           "doc": "<p>The value to find</p>\n",
105           "optional": false
106         }
107       ],
108       "return": {
109         "type": "void",
110         "doc": "\n"
111       },
112       "private": false,
113       "static": false,
114       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
115       "linenr": 388,
116       "html_filename": "Object.html",
117       "href": "Object.html#Ext-Object-method-getKey",
118       "shortDoc": "Returns the first matching key corresponding to the given value.\nIf no matching value is found, null is returned.\n\nva..."
119     },
120     {
121       "tagname": "method",
122       "name": "getKeys",
123       "member": "Ext.Object",
124       "doc": "<p>Gets all keys of the given object as an array.</p>\n\n<pre><code>var values = Ext.Object.getKeys({\n    name: 'Jacky',\n    loves: 'food'\n}); // ['name', 'loves']\n</code></pre>\n",
125       "params": [
126         {
127           "type": "Object",
128           "name": "object",
129           "doc": "\n",
130           "optional": false
131         }
132       ],
133       "return": {
134         "type": "Array",
135         "doc": "<p>An array of keys from the object</p>\n"
136       },
137       "private": false,
138       "static": false,
139       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
140       "linenr": 438,
141       "html_filename": "Object.html",
142       "href": "Object.html#Ext-Object-method-getKeys",
143       "shortDoc": "Gets all keys of the given object as an array.\n\nvar values = Ext.Object.getKeys({\n    name: 'Jacky',\n    loves: 'food..."
144     },
145     {
146       "tagname": "method",
147       "name": "getSize",
148       "member": "Ext.Object",
149       "doc": "<p>Gets the total number of this object's own properties</p>\n\n<pre><code>var size = Ext.Object.getSize({\n    name: 'Jacky',\n    loves: 'food'\n}); // size equals 2\n</code></pre>\n",
150       "params": [
151         {
152           "type": "Object",
153           "name": "object",
154           "doc": "\n",
155           "optional": false
156         }
157       ],
158       "return": {
159         "type": "Number",
160         "doc": "<p>size</p>\n"
161       },
162       "private": false,
163       "static": false,
164       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
165       "linenr": 463,
166       "html_filename": "Object.html",
167       "href": "Object.html#Ext-Object-method-getSize",
168       "shortDoc": "Gets the total number of this object's own properties\n\nvar size = Ext.Object.getSize({\n    name: 'Jacky',\n    loves: ..."
169     },
170     {
171       "tagname": "method",
172       "name": "getValues",
173       "member": "Ext.Object",
174       "doc": "<p>Gets all values of the given object as an array.</p>\n\n<pre><code>var values = Ext.Object.getValues({\n    name: 'Jacky',\n    loves: 'food'\n}); // ['Jacky', 'food']\n</code></pre>\n",
175       "params": [
176         {
177           "type": "Object",
178           "name": "object",
179           "doc": "\n",
180           "optional": false
181         }
182       ],
183       "return": {
184         "type": "Array",
185         "doc": "<p>An array of values from the object</p>\n"
186       },
187       "private": false,
188       "static": false,
189       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
190       "linenr": 413,
191       "html_filename": "Object.html",
192       "href": "Object.html#Ext-Object-method-getValues",
193       "shortDoc": "Gets all values of the given object as an array.\n\nvar values = Ext.Object.getValues({\n    name: 'Jacky',\n    loves: '..."
194     },
195     {
196       "tagname": "method",
197       "name": "merge",
198       "member": "Ext.Object",
199       "doc": "<p>Merges any number of objects recursively without referencing them or their children.</p>\n\n<pre><code>var extjs = {\n    companyName: 'Ext JS',\n    products: ['Ext JS', 'Ext GWT', 'Ext Designer'],\n    isSuperCool: true\n    office: {\n        size: 2000,\n        location: 'Palo Alto',\n        isFun: true\n    }\n};\n\nvar newStuff = {\n    companyName: 'Sencha Inc.',\n    products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],\n    office: {\n        size: 40000,\n        location: 'Redwood City'\n    }\n};\n\nvar sencha = Ext.Object.merge(extjs, newStuff);\n\n// extjs and sencha then equals to\n{\n    companyName: 'Sencha Inc.',\n    products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],\n    isSuperCool: true\n    office: {\n        size: 30000,\n        location: 'Redwood City'\n        isFun: true\n    }\n}\n</code></pre>\n",
200       "params": [
201         {
202           "type": "Object",
203           "name": "object",
204           "doc": "<p>,...</p>\n",
205           "optional": false
206         },
207         {
208           "type": "Object",
209           "name": "key",
210           "doc": "\n",
211           "optional": false
212         },
213         {
214           "type": "Object",
215           "name": "value",
216           "doc": "\n",
217           "optional": false
218         }
219       ],
220       "return": {
221         "type": "Object",
222         "doc": "<p>merged The object that is created as a result of merging all the objects passed in.</p>\n"
223       },
224       "private": false,
225       "static": false,
226       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
227       "linenr": 313,
228       "html_filename": "Object.html",
229       "href": "Object.html#Ext-Object-method-merge",
230       "shortDoc": "Merges any number of objects recursively without referencing them or their children.\n\nvar extjs = {\n    companyName: ..."
231     },
232     {
233       "tagname": "method",
234       "name": "toQueryObjects",
235       "member": "Ext.Object",
236       "doc": "<p>Convert a <code>name</code> - <code>value</code> pair to an array of objects with support for nested structures; useful to construct\nquery strings. For example:</p>\n\n<pre><code>var objects = Ext.Object.toQueryObjects('hobbies', ['reading', 'cooking', 'swimming']);\n\n// objects then equals:\n[\n    { name: 'hobbies', value: 'reading' },\n    { name: 'hobbies', value: 'cooking' },\n    { name: 'hobbies', value: 'swimming' },\n];\n\nvar objects = Ext.Object.toQueryObjects('dateOfBirth', {\n    day: 3,\n    month: 8,\n    year: 1987,\n    extra: {\n        hour: 4\n        minute: 30\n    }\n}, true); // Recursive\n\n// objects then equals:\n[\n    { name: 'dateOfBirth[day]', value: 3 },\n    { name: 'dateOfBirth[month]', value: 8 },\n    { name: 'dateOfBirth[year]', value: 1987 },\n    { name: 'dateOfBirth[extra][hour]', value: 4 },\n    { name: 'dateOfBirth[extra][minute]', value: 30 },\n];\n</code></pre>\n",
237       "params": [
238         {
239           "type": "String",
240           "name": "name",
241           "doc": "\n",
242           "optional": false
243         },
244         {
245           "type": "Mixed",
246           "name": "value",
247           "doc": "\n",
248           "optional": false
249         },
250         {
251           "type": "Boolean",
252           "name": "recursive",
253           "doc": "\n",
254           "optional": false
255         }
256       ],
257       "return": {
258         "type": "void",
259         "doc": "\n"
260       },
261       "private": false,
262       "static": false,
263       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
264       "linenr": 15,
265       "html_filename": "Object.html",
266       "href": "Object.html#Ext-Object-method-toQueryObjects",
267       "shortDoc": "Convert a name - value pair to an array of objects with support for nested structures; useful to construct\nquery stri..."
268     },
269     {
270       "tagname": "method",
271       "name": "toQueryString",
272       "member": "Ext.Object",
273       "doc": "<p>Takes an object and converts it to an encoded query string</p>\n\n<ul>\n<li><p>Non-recursive:</p>\n\n<p>  Ext.Object.toQueryString({foo: 1, bar: 2}); // returns \"foo=1&amp;bar=2\"\n  Ext.Object.toQueryString({foo: null, bar: 2}); // returns \"foo=&amp;bar=2\"\n  Ext.Object.toQueryString({'some price': '$300'}); // returns \"some%20price=%24300\"\n  Ext.Object.toQueryString({date: new Date(2011, 0, 1)}); // returns \"date=%222011-01-01T00%3A00%3A00%22\"\n  Ext.Object.toQueryString({colors: ['red', 'green', 'blue']}); // returns \"colors=red&amp;colors=green&amp;colors=blue\"</p></li>\n<li><p>Recursive:</p>\n\n<p>  Ext.Object.toQueryString({</p>\n\n<pre><code>  username: 'Jacky',\n  dateOfBirth: {\n      day: 1,\n      month: 2,\n      year: 1911\n  },\n  hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']]\n</code></pre>\n\n  }, true); // returns the following string (broken down and url-decoded for ease of reading purpose):\n\n<pre><code>        // username=Jacky\n        //    &amp;dateOfBirth[day]=1&amp;dateOfBirth[month]=2&amp;dateOfBirth[year]=1911\n        //    &amp;hobbies[0]=coding&amp;hobbies[1]=eating&amp;hobbies[2]=sleeping&amp;hobbies[3][0]=nested&amp;hobbies[3][1]=stuff\n</code></pre></li>\n</ul>\n\n",
274       "params": [
275         {
276           "type": "Object",
277           "name": "object",
278           "doc": "<p>The object to encode</p>\n",
279           "optional": false
280         },
281         {
282           "type": "Boolean",
283           "name": "recursive",
284           "doc": "<p>(optional) Whether or not to interpret the object in recursive format.\n(PHP / Ruby on Rails servers and similar). Defaults to false</p>\n",
285           "optional": true
286         }
287       ],
288       "return": {
289         "type": "String",
290         "doc": "<p>queryString</p>\n"
291       },
292       "private": false,
293       "static": false,
294       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
295       "linenr": 95,
296       "html_filename": "Object.html",
297       "href": "Object.html#Ext-Object-method-toQueryString",
298       "shortDoc": "Takes an object and converts it to an encoded query string\n\n\nNon-recursive:\n\n  Ext.Object.toQueryString({foo: 1, bar:..."
299     }
300   ],
301   "property": [
302
303   ],
304   "event": [
305
306   ],
307   "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Object.js",
308   "linenr": 1,
309   "html_filename": "Object.html",
310   "href": "Object.html#Ext-Object",
311   "cssVar": [
312
313   ],
314   "cssMixin": [
315
316   ],
317   "component": false,
318   "superclasses": [
319
320   ],
321   "subclasses": [
322
323   ],
324   "mixedInto": [
325
326   ],
327   "allMixins": [
328
329   ]
330 });