/ext-4.1.0_b3/docs/extjs/examples/tree/xml-tree.js

https://bitbucket.org/srogerf/javascript · JavaScript · 51 lines · 47 code · 3 blank · 1 comment · 0 complexity · b592431cca1b1efe062deb9c86d67427 MD5 · raw file

  1. Ext.require([
  2. 'Ext.tree.*',
  3. 'Ext.data.*'
  4. ]);
  5. Ext.onReady(function() {
  6. var store = Ext.create('Ext.data.TreeStore', {
  7. proxy: {
  8. type: 'ajax',
  9. url: 'get-nodes.php',
  10. extraParams: {
  11. isXml: true
  12. },
  13. reader: {
  14. type: 'xml',
  15. root: 'nodes',
  16. record: 'node'
  17. }
  18. },
  19. sorters: [{
  20. property: 'leaf',
  21. direction: 'ASC'
  22. },{
  23. property: 'text',
  24. direction: 'ASC'
  25. }],
  26. root: {
  27. text: 'Ext JS',
  28. id: 'src',
  29. expanded: true
  30. }
  31. });
  32. // create the Tree
  33. var tree = Ext.create('Ext.tree.Panel', {
  34. store: store,
  35. hideHeaders: true,
  36. rootVisible: true,
  37. viewConfig: {
  38. plugins: [{
  39. ptype: 'treeviewdragdrop'
  40. }]
  41. },
  42. height: 350,
  43. width: 400,
  44. title: 'Directory Listing',
  45. renderTo: 'tree-example',
  46. collapsible: true
  47. });
  48. });