DocumentTreePanel.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. Ext.define('erp.view.plm.document.DocumentTreePanel',{
  2. extend: 'Ext.tree.Panel',
  3. alias: 'widget.erpDocumentTreePanel',
  4. BaseUtil: Ext.create('erp.util.BaseUtil'),
  5. id: 'DocumentTree',
  6. //margins : '0 0 -1 1',
  7. //border : false,
  8. //enableDD : false,
  9. split: true,
  10. width : '30%',
  11. region: 'east',
  12. title: "<font color=#a1a1a1; size=3;weight= bold;>文档管理</font>",
  13. toggleCollapse: function() {
  14. if (this.collapsed) {
  15. this.expand(this.animCollapse);
  16. } else {
  17. this.title ='文档管理';
  18. this.collapse(this.collapseDirection, this.animCollapse);
  19. }
  20. return this;
  21. },
  22. rootVisible: false,
  23. singleExpand: false,
  24. containerScroll : true,
  25. collapsible : true,
  26. autoScroll: false,
  27. useArrows: true,
  28. select:null,
  29. lines:true,
  30. viewConfig:{
  31. expandedCls:'x-node-expanded',
  32. itemCls:'tree-cls-parent'
  33. },
  34. bodyStyle:'background-color:#f0f0f0',
  35. store: Ext.create('Ext.data.TreeStore', {
  36. root : {
  37. text: 'root',
  38. id: 'root',
  39. expanded: true
  40. }
  41. }),
  42. initComponent : function(){
  43. this.getTreeRootNode();
  44. this.callParent(arguments);
  45. },
  46. getTreeRootNode: function(){
  47. Ext.Ajax.request({
  48. url : basePath + 'plm/document/getAllDirectorys.action',
  49. callback : function(options,success,response){
  50. var res = new Ext.decode(response.responseText);
  51. if(res.tree){
  52. var tree = res.tree;
  53. Ext.getCmp('DocumentTree').store.setRootNode({
  54. text: 'root',
  55. id: 'root',
  56. expanded: true,
  57. children: tree
  58. });
  59. } else if(res.exceptionInfo){
  60. showError(res.exceptionInfo);
  61. }
  62. }
  63. });
  64. },
  65. listeners: {
  66. scrollershow: function(scroller) {
  67. if (scroller && scroller.scrollEl) {
  68. scroller.clearManagedListeners();
  69. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  70. }
  71. }
  72. }
  73. });