commit extjs-2.2.1
[extjs.git] / docs / output / Ext.tree.TreeSorter.html
1         <div class="body-wrap">
2         <div class="top-tools">
3             <a class="inner-link" href="#Ext.tree.TreeSorter-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
4             <a class="inner-link" href="#Ext.tree.TreeSorter-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
5             <a class="inner-link" href="#Ext.tree.TreeSorter-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
6                             <a class="inner-link" href="#Ext.tree.TreeSorter-configs"><img src="../resources/images/default/s.gif" class="item-icon icon-config">Config Options</a>
7                         <a class="bookmark" href="../docs/?class=Ext.tree.TreeSorter"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
8         </div>
9                 <h1>Class Ext.tree.TreeSorter</h1>
10         <table cellspacing="0">
11             <tr><td class="label">Package:</td><td class="hd-info">Ext.tree</td></tr>
12             <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/TreeSorter.js" target="_blank">TreeSorter.js</a></td></tr>
13             <tr><td class="label">Class:</td><td class="hd-info">TreeSorter</td></tr>
14                                     <tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr>
15                     </table>
16         <div class="description">
17             *
18 Provides sorting of nodes in a <a ext:cls="Ext.tree.TreePanel" href="output/Ext.tree.TreePanel.html">Ext.tree.TreePanel</a>.  The TreeSorter automatically monitors events on the 
19 associated TreePanel that might affect the tree's sort order (beforechildrenrendered, append, insert and textchange).
20 Example usage:<br />
21 <pre><code>new Ext.tree.TreeSorter(myTree, {
22     folderSort: true,
23     dir: <em>"desc"</em>,
24     sortType: <b>function</b>(node) {
25         <i>// sort by a custom, typed attribute:</i>
26         <b>return</b> parseInt(node.id, 10);
27     }
28 });</code></pre>        </div>
29         
30         <div class="hr"></div>
31                 <a id="Ext.tree.TreeSorter-configs"></a>
32         <h2>Config Options</h2>
33         <table cellspacing="0" class="member-table">
34             <tr>
35                 <th class="sig-header" colspan="2">Config Options</th>
36                 <th class="msource-header">Defined By</th>
37             </tr>
38                 <tr class="config-row">\r
39         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
40         <td class="sig">\r
41         <a id="Ext.tree.TreeSorter-caseSensitive"></a>\r
42             <b>caseSensitive</b> : Boolean            <div class="mdesc">\r
43                             true for case-sensitive sort (defaults to false)                        </div>\r
44         </td>\r
45         <td class="msource">TreeSorter</td>\r
46     </tr>\r
47         <tr class="config-row alt">\r
48         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
49         <td class="sig">\r
50         <a id="Ext.tree.TreeSorter-dir"></a>\r
51             <b>dir</b> : String            <div class="mdesc">\r
52                             The direction to sort ("asc" or "desc," case-insensitive, defaults to "asc")                        </div>\r
53         </td>\r
54         <td class="msource">TreeSorter</td>\r
55     </tr>\r
56         <tr class="config-row">\r
57         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
58         <td class="sig">\r
59         <a id="Ext.tree.TreeSorter-folderSort"></a>\r
60             <b>folderSort</b> : Boolean            <div class="mdesc">\r
61                             True to sort leaf nodes under non-leaf nodes (defaults to false)                        </div>\r
62         </td>\r
63         <td class="msource">TreeSorter</td>\r
64     </tr>\r
65         <tr class="config-row alt">\r
66         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
67         <td class="sig">\r
68         <a id="Ext.tree.TreeSorter-leafAttr"></a>\r
69             <b>leafAttr</b> : String            <div class="mdesc">\r
70                             The attribute used to determine leaf nodes when <a ext:cls="Ext.tree.TreeSorter" ext:member="folderSort" href="output/Ext.tree.TreeSorter.html#folderSort">folderSort</a> = true (defaults to "leaf")                        </div>\r
71         </td>\r
72         <td class="msource">TreeSorter</td>\r
73     </tr>\r
74         <tr class="config-row expandable">\r
75         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
76         <td class="sig">\r
77         <a id="Ext.tree.TreeSorter-property"></a>\r
78             <b>property</b> : String            <div class="mdesc">\r
79                         <div class="short">The named attribute on the node to sort by (defaults to "text"). Note that this property is only used if no sortType ...</div>\r
80             <div class="long">\r
81                 The named attribute on the node to sort by (defaults to "text"). Note that this property is only used if no <a ext:cls="Ext.tree.TreeSorter" ext:member="sortType" href="output/Ext.tree.TreeSorter.html#sortType">sortType</a> function is specified, otherwise it is ignored.            </div>\r
82                         </div>\r
83         </td>\r
84         <td class="msource">TreeSorter</td>\r
85     </tr>\r
86         <tr class="config-row alt expandable">\r
87         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
88         <td class="sig">\r
89         <a id="Ext.tree.TreeSorter-sortType"></a>\r
90             <b>sortType</b> : Function            <div class="mdesc">\r
91                         <div class="short">A custom "casting" function used to convert node values before sorting. The function will be called with a single par...</div>\r
92             <div class="long">\r
93                 A custom "casting" function used to convert node values before sorting. The function will be called with a single parameter (the <a ext:cls="Ext.tree.TreeNode" href="output/Ext.tree.TreeNode.html">Ext.tree.TreeNode</a> being evaluated) and is expected to return the node's sort value cast to the specific data type required for sorting. This could be used, for example, when a node's text (or other attribute) should be sorted as a date or numeric value. See the class description for example usage. Note that if a sortType is specified, any <a ext:cls="Ext.tree.TreeSorter" ext:member="property" href="output/Ext.tree.TreeSorter.html#property">property</a> config will be ignored.            </div>\r
94                         </div>\r
95         </td>\r
96         <td class="msource">TreeSorter</td>\r
97     </tr>\r
98             </table>
99                 <a id="Ext.tree.TreeSorter-props"></a>
100         <h2>Public Properties</h2>
101         <div class="no-members">This class has no public properties.</div>        <a id="Ext.tree.TreeSorter-methods"></a>
102         <h2>Public Methods</h2>
103                 <table cellspacing="0" class="member-table">
104             <tr>
105                 <th class="sig-header" colspan="2">Method</th>
106                 <th class="msource-header">Defined By</th>
107             </tr>
108                 <tr class="method-row expandable">\r
109         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
110         <td class="sig">\r
111         <a id="Ext.tree.TreeSorter-TreeSorter"></a>\r
112             <b>TreeSorter</b>(&nbsp;<code>TreePanel tree</code>, <code>Object config</code>&nbsp;)            <div class="mdesc">\r
113                         <div class="short"></div>\r
114             <div class="long">\r
115                     <div class="mdetail-params">\r
116         <strong>Parameters:</strong>\r
117         <ul><li><code>tree</code> : TreePanel<div class="sub-desc"></div></li><li><code>config</code> : Object<div class="sub-desc"></div></li>        </ul>\r
118         <strong>Returns:</strong>\r
119         <ul>\r
120             <li><code></code></li>\r
121         </ul>\r
122     </div>\r
123                 </div>\r
124                         </div>\r
125         </td>\r
126         <td class="msource">TreeSorter</td>\r
127     </tr>\r
128             </table>
129                 <a id="Ext.tree.TreeSorter-events"></a>
130         <h2>Public Events</h2>
131         <div class="no-members">This class has no public events.</div>
132         </div>