3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">var TreeTest = function(){
\r
10 var Tree = Ext.tree;
\r
15 var tree = new Tree.TreePanel({
\r
18 loader: new Tree.TreeLoader({dataUrl:'get-nodes.php'}),
\r
19 containerScroll: true,
\r
25 // add a tree sorter in folder mode
\r
26 new Tree.TreeSorter(tree, {folderSort:true});
\r
28 // set the root node
\r
29 var root = new Tree.AsyncTreeNode({
\r
31 draggable:false, // disable root node dragging
\r
34 tree.setRootNode(root);
\r
37 tree.render('tree');
\r
38 root.expand(false, /*no anim*/ false);
\r
39 tree.bodyFocus.fi.setFrameEl(tree.el);
\r
40 tree.getSelectionModel().select(tree.getRootNode());
\r
41 tree.enter.defer(100, tree);
\r
46 Ext.EventManager.onDocumentReady(TreeTest.init, TreeTest, true);</pre>
\r