KnowledgeTreePanel.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Ext.define('erp.view.oa.knowledge.KnowledgeTreePanel',{
  2. extend: 'Ext.tree.Panel',
  3. alias: 'widget.erpKnowledgeTreePanel',
  4. BaseUtil: Ext.create('erp.util.BaseUtil'),
  5. id: 'KnowledgeTree',
  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.collapse(this.collapseDirection, this.animCollapse);
  18. }
  19. return this;
  20. },
  21. rootVisible: false,
  22. singleExpand: false,
  23. containerScroll : true,
  24. collapsible : true,
  25. autoScroll: false,
  26. useArrows: true,
  27. select:null,
  28. bodyStyle:'background-color:#f1f1f1;',
  29. store: Ext.create('Ext.data.TreeStore', {
  30. root : {
  31. text: 'root',
  32. id: 'root',
  33. expanded: true
  34. }
  35. }),
  36. initComponent : function(){
  37. this.getTreeRootNode();
  38. this.callParent(arguments);
  39. },
  40. getTreeRootNode: function(){
  41. Ext.Ajax.request({
  42. url : basePath + 'oa/knowledge/getKnowledgeModule.action',
  43. callback : function(options,success,response){
  44. var res = new Ext.decode(response.responseText);
  45. if(res.tree){
  46. var tree = res.tree;
  47. Ext.getCmp('KnowledgeTree').store.setRootNode({
  48. text: 'root',
  49. id: 'root',
  50. expanded: true,
  51. children: tree
  52. });
  53. } else if(res.exceptionInfo){
  54. showError(res.exceptionInfo);
  55. }
  56. }
  57. });
  58. },
  59. listeners: {
  60. scrollershow: function(scroller) {
  61. if (scroller && scroller.scrollEl) {
  62. scroller.clearManagedListeners();
  63. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  64. }
  65. }
  66. }
  67. });