two-trees.js
上传用户:dawnssy
上传日期:2022-08-06
资源大小:9345k
文件大小:2k
源码类别:

JavaScript

开发平台:

JavaScript

  1. /*!  * Ext JS Library 3.1.0  * Copyright(c) 2006-2009 Ext JS, LLC  * licensing@extjs.com  * http://www.extjs.com/license  */ var TreeTest = function(){
  2.     // shorthand
  3.     var Tree = Ext.tree;
  4.     
  5.     return {
  6.         init : function(){
  7.             // yui-ext tree
  8.             var tree = new Tree.TreePanel({
  9.                 animate:true, 
  10.                 autoScroll:true,
  11.                 loader: new Tree.TreeLoader({dataUrl:'get-nodes.php'}),
  12.                 enableDD:true,
  13.                 containerScroll: true,
  14.                 border: false,
  15.                 width: 250,
  16.                 height: 300,
  17.                 dropConfig: {appendOnly:true}
  18.             });
  19.             
  20.             // add a tree sorter in folder mode
  21.             new Tree.TreeSorter(tree, {folderSort:true});
  22.             
  23.             // set the root node
  24.             var root = new Tree.AsyncTreeNode({
  25.                 text: 'Ext JS', 
  26.                 draggable:false, // disable root node dragging
  27.                 id:'src'
  28.             });
  29.             tree.setRootNode(root);
  30.             
  31.             // render the tree
  32.             tree.render('tree');
  33.             
  34.             root.expand(false, /*no anim*/ false);
  35.             
  36.             //-------------------------------------------------------------
  37.             
  38.             // ExtJS tree            
  39.             var tree2 = new Tree.TreePanel({
  40.                 animate:true,
  41.                 autoScroll:true,
  42.                 //rootVisible: false,
  43.                 loader: new Ext.tree.TreeLoader({
  44.                     dataUrl:'get-nodes.php',
  45.                     baseParams: {path:'extjs'} // custom http params
  46.                 }),
  47.                 containerScroll: true,
  48.                 border: false,
  49.                 width: 250,
  50.                 height: 300,
  51.                 enableDD:true,
  52.                 dropConfig: {appendOnly:true}
  53.             });
  54.             
  55.             // add a tree sorter in folder mode
  56.             new Tree.TreeSorter(tree2, {folderSort:true});
  57.             
  58.             // add the root node
  59.             var root2 = new Tree.AsyncTreeNode({
  60.                 text: 'Extensions', 
  61.                 draggable:false, 
  62.                 id:'ux'
  63.             });
  64.             tree2.setRootNode(root2);
  65.             tree2.render('tree2');
  66.             
  67.             root2.expand(false, /*no anim*/ false);
  68.         }
  69.     };
  70. }();
  71. Ext.EventManager.onDocumentReady(TreeTest.init, TreeTest, true);