Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / examples / tree / reorder.js
1 Ext.require([
2     'Ext.tree.*',
3     'Ext.data.*',
4     'Ext.tip.*'
5 ]);
6
7 Ext.onReady(function() {
8     Ext.QuickTips.init();
9     
10     var store = Ext.create('Ext.data.TreeStore', {
11         proxy: {
12             type: 'ajax',
13             url: 'get-nodes.php'
14         },
15         root: {
16             text: 'Ext JS',
17             id: 'src',
18             expanded: true
19         },
20         folderSort: true,
21         sorters: [{
22             property: 'text',
23             direction: 'ASC'
24         }]
25     });
26
27     var tree = Ext.create('Ext.tree.Panel', {
28         store: store,
29         viewConfig: {
30             plugins: {
31                 ptype: 'treeviewdragdrop'
32             }
33         },
34         renderTo: 'tree-div',
35         height: 300,
36         width: 250,
37         title: 'Files',
38         useArrows: true,
39         dockedItems: [{
40             xtype: 'toolbar',
41             items: [{
42                 text: 'Expand All',
43                 handler: function(){
44                     tree.expandAll();
45                 }
46             }, {
47                 text: 'Collapse All',
48                 handler: function(){
49                     tree.collapseAll();
50                 }
51             }]
52         }]
53     });
54 });