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.

58 lines
1.8 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. containerScroll: true,
  26. border: false,
  27. height: 300,
  28. width: 300
  29. });
  30. // add a tree sorter in folder mode
  31. new Tree.TreeSorter(tree, {folderSort:true});
  32. // set the root node
  33. var root = new Tree.AsyncTreeNode({
  34. text: 'Ext JS',
  35. draggable:false, // disable root node dragging
  36. id:'src'
  37. });
  38. tree.setRootNode(root);
  39. // render the tree
  40. tree.render('tree');
  41. root.expand(false, /*no anim*/ false);
  42. tree.bodyFocus.fi.setFrameEl(tree.el);
  43. tree.getSelectionModel().select(tree.getRootNode());
  44. tree.enter.defer(100, tree);
  45. }
  46. };
  47. }();
  48. Ext.EventManager.onDocumentReady(TreeTest.init, TreeTest, true);