Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / output / Ext.util.Sorter.js
1 Ext.data.JsonP.Ext_util_Sorter({
2   "allMixins": [
3
4   ],
5   "deprecated": null,
6   "docauthor": null,
7   "members": {
8     "cfg": [
9       {
10         "type": "String",
11         "deprecated": null,
12         "alias": null,
13         "protected": false,
14         "tagname": "cfg",
15         "href": "Sorter.html#Ext-util-Sorter-cfg-direction",
16         "shortDoc": "The direction to sort by. ...",
17         "static": false,
18         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
19         "private": false,
20         "name": "direction",
21         "owner": "Ext.util.Sorter",
22         "doc": "<p>The direction to sort by. Defaults to ASC</p>\n",
23         "linenr": 87,
24         "html_filename": "Sorter.html"
25       },
26       {
27         "type": "String",
28         "deprecated": null,
29         "alias": null,
30         "protected": false,
31         "tagname": "cfg",
32         "href": "Sorter.html#Ext-util-Sorter-cfg-property",
33         "shortDoc": "The property to sort by. ...",
34         "static": false,
35         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
36         "private": false,
37         "name": "property",
38         "owner": "Ext.util.Sorter",
39         "doc": "<p>The property to sort by. Required unless <a href=\"#/api/Ext.util.Sorter-cfg-sorterFn\" rel=\"Ext.util.Sorter-cfg-sorterFn\" class=\"docClass\">sorterFn</a> is provided.\nThe property is extracted from the object directly and compared for sorting using the built in\ncomparison operators.</p>\n",
40         "linenr": 59,
41         "html_filename": "Sorter.html"
42       },
43       {
44         "type": "String",
45         "deprecated": null,
46         "alias": null,
47         "protected": false,
48         "tagname": "cfg",
49         "href": "Sorter.html#Ext-util-Sorter-cfg-root",
50         "shortDoc": "Optional root property. ...",
51         "static": false,
52         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
53         "private": false,
54         "name": "root",
55         "owner": "Ext.util.Sorter",
56         "doc": "<p>Optional root property. This is mostly useful when sorting a Store, in which case we set the\nroot to 'data' to make the filter pull the <a href=\"#/api/Ext.util.Sorter-cfg-property\" rel=\"Ext.util.Sorter-cfg-property\" class=\"docClass\">property</a> out of the data object of each item</p>\n",
57         "linenr": 76,
58         "html_filename": "Sorter.html"
59       },
60       {
61         "type": "Function",
62         "deprecated": null,
63         "alias": null,
64         "protected": false,
65         "tagname": "cfg",
66         "href": "Sorter.html#Ext-util-Sorter-cfg-sorterFn",
67         "shortDoc": "A specific sorter function to execute. ...",
68         "static": false,
69         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
70         "private": false,
71         "name": "sorterFn",
72         "owner": "Ext.util.Sorter",
73         "doc": "<p>A specific sorter function to execute. Can be passed instead of <a href=\"#/api/Ext.util.Sorter-cfg-property\" rel=\"Ext.util.Sorter-cfg-property\" class=\"docClass\">property</a>.\nThis sorter function allows for any kind of custom/complex comparisons.\nThe sorterFn receives two arguments, the objects being compared. The function should return:</p>\n\n<ul>\n<li>-1 if o1 is \"less than\" o2</li>\n<li>0 if o1 is \"equal\" to o2</li>\n<li>1 if o1 is \"greater than\" o2</li>\n</ul>\n\n",
74         "linenr": 65,
75         "html_filename": "Sorter.html"
76       },
77       {
78         "type": "Function",
79         "deprecated": null,
80         "alias": null,
81         "protected": false,
82         "tagname": "cfg",
83         "href": "Sorter.html#Ext-util-Sorter-cfg-transform",
84         "shortDoc": "A function that will be run on each value before\nit is compared in the sorter. ...",
85         "static": false,
86         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
87         "private": false,
88         "name": "transform",
89         "owner": "Ext.util.Sorter",
90         "doc": "<p>A function that will be run on each value before\nit is compared in the sorter. The function will receive a single argument,\nthe value.</p>\n",
91         "linenr": 81,
92         "html_filename": "Sorter.html"
93       }
94     ],
95     "method": [
96       {
97         "deprecated": null,
98         "alias": null,
99         "protected": false,
100         "tagname": "method",
101         "href": "Sorter.html#Ext-util-Sorter-method-setDirection",
102         "shortDoc": "Set the sorting direction for this sorter. ...",
103         "static": false,
104         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
105         "private": false,
106         "params": [
107           {
108             "type": "String",
109             "optional": false,
110             "doc": "<p>The direction to sort in. Should be either 'ASC' or 'DESC'.</p>\n",
111             "name": "direction"
112           }
113         ],
114         "name": "setDirection",
115         "owner": "Ext.util.Sorter",
116         "doc": "<p>Set the sorting direction for this sorter.</p>\n",
117         "linenr": 152,
118         "return": {
119           "type": "void",
120           "doc": "\n"
121         },
122         "html_filename": "Sorter.html"
123       },
124       {
125         "deprecated": null,
126         "alias": null,
127         "protected": false,
128         "tagname": "method",
129         "href": "Sorter.html#Ext-util-Sorter-method-toggle",
130         "shortDoc": "Toggles the sorting direction for this sorter. ...",
131         "static": false,
132         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
133         "private": false,
134         "params": [
135
136         ],
137         "name": "toggle",
138         "owner": "Ext.util.Sorter",
139         "doc": "<p>Toggles the sorting direction for this sorter.</p>\n",
140         "linenr": 162,
141         "return": {
142           "type": "void",
143           "doc": "\n"
144         },
145         "html_filename": "Sorter.html"
146       },
147       {
148         "deprecated": null,
149         "alias": null,
150         "protected": false,
151         "tagname": "method",
152         "href": "Sorter.html#Ext-util-Sorter-method-updateSortFunction",
153         "shortDoc": "Update the sort function for this sorter. ...",
154         "static": false,
155         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
156         "private": false,
157         "params": [
158           {
159             "type": "Function",
160             "optional": false,
161             "doc": "<p>(Optional) A new sorter function for this sorter. If not specified it will use the\ndefault sorting function.</p>\n",
162             "name": "fn"
163           }
164         ],
165         "name": "updateSortFunction",
166         "owner": "Ext.util.Sorter",
167         "doc": "<p>Update the sort function for this sorter.</p>\n",
168         "linenr": 171,
169         "return": {
170           "type": "void",
171           "doc": "\n"
172         },
173         "html_filename": "Sorter.html"
174       }
175     ],
176     "property": [
177
178     ],
179     "cssVar": [
180
181     ],
182     "cssMixin": [
183
184     ],
185     "event": [
186
187     ]
188   },
189   "singleton": false,
190   "alias": null,
191   "superclasses": [
192
193   ],
194   "protected": false,
195   "tagname": "class",
196   "mixins": [
197
198   ],
199   "href": "Sorter.html#Ext-util-Sorter",
200   "subclasses": [
201     "Ext.util.Grouper"
202   ],
203   "static": false,
204   "author": null,
205   "component": false,
206   "filename": "/mnt/ebs/nightly/git/SDK/platform/src/util/Sorter.js",
207   "private": false,
208   "alternateClassNames": [
209
210   ],
211   "name": "Ext.util.Sorter",
212   "doc": "<p>Represents a single sorter that can be applied to a Store. The sorter is used\nto compare two values against each other for the purpose of ordering them. Ordering\nis achieved by specifying either:\n- <a href=\"#/api/Ext.util.Sorter-cfg-property\" rel=\"Ext.util.Sorter-cfg-property\" class=\"docClass\">A sorting property</a>\n- <a href=\"#/api/Ext.util.Sorter-cfg-sorterFn\" rel=\"Ext.util.Sorter-cfg-sorterFn\" class=\"docClass\">A sorting function</a></p>\n\n<p>As a contrived example, we can specify a custom sorter that sorts by rank:</p>\n\n<pre><code>Ext.define('Person', {\n    extend: 'Ext.data.Model',\n    fields: ['name', 'rank']\n});\n\nExt.create('Ext.data.Store', {\n    model: 'Person',\n    proxy: 'memory',\n    sorters: [{\n        sorterFn: function(o1, o2){\n            var getRank = function(o){\n                var name = o.get('rank');\n                if (name === 'first') {\n                    return 1;\n                } else if (name === 'second') {\n                    return 2;\n                } else {\n                    return 3;\n                }\n            },\n            rank1 = getRank(o1),\n            rank2 = getRank(o2);\n\n            if (rank1 === rank2) {\n                return 0;\n            }\n\n            return rank1 &lt; rank2 ? -1 : 1;\n        }\n    }],\n    data: [{\n        name: 'Person1',\n        rank: 'second'\n    }, {\n        name: 'Person2',\n        rank: 'third'\n    }, {\n        name: 'Person3',\n        rank: 'first'\n    }] \n});\n</code></pre>\n",
213   "mixedInto": [
214
215   ],
216   "linenr": 1,
217   "xtypes": [
218
219   ],
220   "html_filename": "Sorter.html",
221   "extends": "Object"
222 });