1.
1 /** 2 * @author sux 3 * @time 2011-1-11 4 * @desc main page 5 */ 6 7 var mainPage = Ext.extend(Ext.Viewport,{ 8 9 10 /** 11 * 构造方法中进行整体布局 12 */ 13 constructor: function(username, date){ 14 //这个意思就是调用父类的构造函数 作用域是当前子类 传入config参数 将来config中有什么属性 会为子类构造出什么属性 15 mainPage.superclass.constructor.call(this,{ 16 //方位布局 17 layout: 'border', 18 items: [{ 19 //我们需要在items中使用region参数来给它定位。 20 region: 'north', 21 xtype: 'panel', 22 //html: '人力资源管理系统', 23 bodyStyle: 'height: 66px;', 24 layout: 'absolute', 25 html: '
' 30 },{ 31 region: 'west', 32 frame: 'true', 33 width: '200', 34 id: 'menu_tree', 35 xtype: 'panel', 36 autoScroll: true, 37 title: '人力资源管理系统', 38 split: true, 39 collapsible: true,//可折叠 40 items: [{ 41 xtype: 'treepanel', 42 title: '', 43 autoScroll: true, 44 border: false, 45 id: 'tree', 46 rootVisible:true,//不隐藏根节点 47 // tools: [{ 48 // id: 'refresh', 49 // handler: '', 50 // scope: this 51 // }], 52 //loader:树节点的加载器,默认为Ext.tree.TreeLoader 53 loader: new Ext.tree.TreeLoader({ 54 dataUrl: 'menu.action'// dataUrl:获取子节点的URL地址。 55 }), 56 //每加入进来的节点,若为非叶子节点则做为根节点继续进行查找 57 // root:树的根节点。 58 root: new Ext.tree.AsyncTreeNode({ 59 text: '人力资源管理', 60 expanded :true,// expanded:是否展开节点,默认为false 61 id: '1' //加载数据时每次以变量node传入id的值如: node=1 62 //leaf: false //数据库中存储的为1/0 63 }), 64 listeners: { 65 'click': { 66 fn: this.clickNode, 67 scope: this 68 } 69 } 70 }] 71 },this.center,{ 72 region: 'south', 73 width: '100%', 74 frame: true, 75 height: 30, 76 html: "
Copyright © 201204 TRJ1101 & 张勇
" 77 }] 78 }); 79 }, 80 81 center: new Ext.TabPanel({ 82 id: 'mainTab', 83 frame: true, 84 region: 'center', 85 activeTab: 0,// 初始激活的tab,索引或者id值,默认为none,从0开始 86 autoScroll: false, 87 enableTabScroll : true, //溢出时滚动tab 88 split: true, 89 //TabCloseMenu一个显示右键菜单的插件 90 //添加编辑插件 91 plugins: new Ext.ux.TabCloseMenu(), 92 93 items: [{ 94 closable: false,// tab是否可关闭,默认为false 95 title: '首页', 96 iconCls: 'main',//css样式 97 98 html: '