/ext-4.1.0_b3/docs/extjs/examples/tree/xml-tree.js
JavaScript | 51 lines | 47 code | 3 blank | 1 comment | 0 complexity | b592431cca1b1efe062deb9c86d67427 MD5 | raw file
1Ext.require([
2 'Ext.tree.*',
3 'Ext.data.*'
4]);
5
6Ext.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});