two-trees.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Ext.require(['*']);
  2. Ext.onReady(function(){
  3. var store = Ext.create('Ext.data.TreeStore', {
  4. proxy: {
  5. type: 'ajax',
  6. url: 'get-nodes.php'
  7. },
  8. root: {
  9. text: 'Ext JS',
  10. id: 'src',
  11. expanded: true
  12. },
  13. folderSort: true,
  14. sorters: [{
  15. property: 'text',
  16. direction: 'ASC'
  17. }]
  18. });
  19. var tree = Ext.create('Ext.tree.Panel', {
  20. id: 'tree',
  21. store: store,
  22. width: 250,
  23. height: 300,
  24. viewConfig: {
  25. plugins: {
  26. ptype: 'treeviewdragdrop',
  27. appendOnly: true
  28. }
  29. },
  30. renderTo: document.body
  31. });
  32. var store2 = Ext.create('Ext.data.TreeStore', {
  33. proxy: {
  34. type: 'ajax',
  35. url: 'get-nodes.php'
  36. },
  37. root: {
  38. text: 'Custom Ext JS',
  39. id: 'src',
  40. expanded: true,
  41. children: []
  42. },
  43. folderSort: true,
  44. sorters: [{
  45. property: 'text',
  46. direction: 'ASC'
  47. }]
  48. });
  49. var tree2 = Ext.create('Ext.tree.Panel', {
  50. id: 'tree2',
  51. width: 250,
  52. height: 300,
  53. store: store2,
  54. viewConfig: {
  55. plugins: {
  56. ptype: 'treeviewdragdrop',
  57. appendOnly: true
  58. }
  59. },
  60. renderTo: document.body
  61. });
  62. });