1
0

demo.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. window.addEvent('domready',function(){
  2. tree = new Mif.Tree({
  3. container: $('tree_container'),
  4. forest: true,
  5. initialize: function(){
  6. new Mif.Tree.KeyNav(this);
  7. new Mif.Tree.Drag(this, {
  8. beforeDrop: function(current, target, where){
  9. if(confirm('drop node?')){
  10. this.drop();
  11. }else{
  12. this.emptydrop();
  13. }
  14. }
  15. });
  16. },
  17. types: {
  18. folder: {
  19. openIcon: 'mif-tree-open-icon',
  20. closeIcon: 'mif-tree-close-icon'
  21. },
  22. loader: {
  23. openIcon: 'mif-tree-loader-open-icon',
  24. closeIcon: 'mif-tree-loader-close-icon',
  25. dropDenied: ['inside','after']
  26. },
  27. disabled: {
  28. openIcon: 'mif-tree-open-icon',
  29. closeIcon: 'mif-tree-close-icon',
  30. dragDisabled: true,
  31. cls: 'disabled'
  32. },
  33. book: {
  34. openIcon: 'mif-tree-book-icon',
  35. closeIcon: 'mif-tree-book-icon',
  36. loadable: true
  37. },
  38. bin: {
  39. openIcon: 'mif-tree-bin-open-icon',
  40. closeIcon: 'mif-tree-bin-close-icon'
  41. }
  42. },
  43. dfltType: 'folder',
  44. height: 18,
  45. onCopy: function(from, to, where, copy){
  46. if(from.getParent() == copy.getParent()){
  47. copy.set({
  48. property: {
  49. name: 'copy ' + from.name
  50. }
  51. });
  52. }
  53. }
  54. });
  55. //tree.initSortable();
  56. tree.load({
  57. url: '../assets/files/forest.json'
  58. });
  59. tree.loadOptions=function(node){
  60. return {
  61. url: '../assets/files/mediumTree.json'
  62. };
  63. };
  64. });