You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.9 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. var TreeTest = function(){
  16. // shorthand
  17. var Tree = Ext.tree;
  18. return {
  19. init : function(){
  20. // yui-ext tree
  21. var tree = new Tree.TreePanel({
  22. animate:true,
  23. autoScroll:true,
  24. loader: new Tree.TreeLoader({dataUrl:'get-nodes.php'}),
  25. enableDD:true,
  26. containerScroll: true,
  27. border: false,
  28. width: 250,
  29. height: 300,
  30. dropConfig: {appendOnly:true}
  31. });
  32. // add a tree sorter in folder mode
  33. new Tree.TreeSorter(tree, {folderSort:true});
  34. // set the root node
  35. var root = new Tree.AsyncTreeNode({
  36. text: 'Ext JS',
  37. draggable:false, // disable root node dragging
  38. id:'src'
  39. });
  40. tree.setRootNode(root);
  41. // render the tree
  42. tree.render('tree');
  43. root.expand(false, /*no anim*/ false);
  44. //-------------------------------------------------------------
  45. // ExtJS tree
  46. var tree2 = new Tree.TreePanel({
  47. animate:true,
  48. autoScroll:true,
  49. //rootVisible: false,
  50. loader: new Ext.tree.TreeLoader({
  51. dataUrl:'get-nodes.php',
  52. baseParams: {path:'extjs'} // custom http params
  53. }),
  54. containerScroll: true,
  55. border: false,
  56. width: 250,
  57. height: 300,
  58. enableDD:true,
  59. dropConfig: {appendOnly:true}
  60. });
  61. // add a tree sorter in folder mode
  62. new Tree.TreeSorter(tree2, {folderSort:true});
  63. // add the root node
  64. var root2 = new Tree.AsyncTreeNode({
  65. text: 'Extensions',
  66. draggable:false,
  67. id:'ux'
  68. });
  69. tree2.setRootNode(root2);
  70. tree2.render('tree2');
  71. root2.expand(false, /*no anim*/ false);
  72. }
  73. };
  74. }();
  75. Ext.EventManager.onDocumentReady(TreeTest.init, TreeTest, true);