Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / examples / tree / xml-tree.js
1 Ext.require([
2     'Ext.tree.*',
3     'Ext.data.*'
4 ]);
5
6 Ext.onReady(function() {
7
8     var store = Ext.create('Ext.data.TreeStore', {
9         proxy: {
10             type: 'ajax',
11             url: 'get-nodes.php',
12             extraParams: {
13                 isXml: true
14             },
15             reader: {
16                 type: 'xml',
17                 root: 'nodes',
18                 record: 'node'
19             }
20         },
21         sorters: [{
22             property: 'leaf',
23             direction: 'ASC'
24         },{
25             property: 'text',
26             direction: 'ASC'
27         }],
28         root: {
29             text: 'Ext JS',
30             id: 'src',
31             expanded: true
32         }
33     });
34
35     // create the Tree
36     var tree = Ext.create('Ext.tree.Panel', {
37         store: store,
38         hideHeaders: true,
39         rootVisible: true,
40         viewConfig: {
41             plugins: [{
42                 ptype: 'treeviewdragdrop'
43             }]
44         },
45         height: 350,
46         width: 400,
47         title: 'Directory Listing',
48         renderTo: 'tree-example',
49         collapsible: true
50     });
51 });