1.

 /**
* @author sux
* @time 2011-1-11
* @desc main page
*/ var mainPage = Ext.extend(Ext.Viewport,{ /**
* 构造方法中进行整体布局
*/
constructor: function(username, date){
//这个意思就是调用父类的构造函数 作用域是当前子类 传入config参数 将来config中有什么属性 会为子类构造出什么属性
mainPage.superclass.constructor.call(this,{
//方位布局
layout: 'border',
items: [{
//我们需要在items中使用region参数来给它定位。
region: 'north',
xtype: 'panel',
//html: '人力资源管理系统',
bodyStyle: 'height: 66px;',
layout: 'absolute',
html: '<table class="header"><tr ><td class="header_left"></td><td class="header_center"></td>' +
'<td class="header_right"><div id="user_header">'+date+'&nbsp;<img src="img/user.png"/>&nbsp;' +
username+'&nbsp;&nbsp;<a href="user_exit.action">注销</a>' +
'</div></td>' +
'</tr></table>'
},{
region: 'west',
frame: 'true',
width: '200',
id: 'menu_tree',
xtype: 'panel',
autoScroll: true,
title: '人力资源管理系统',
split: true,
collapsible: true,//可折叠
items: [{
xtype: 'treepanel',
title: '',
autoScroll: true,
border: false,
id: 'tree',
rootVisible:true,//不隐藏根节点
// tools: [{
// id: 'refresh',
// handler: '',
// scope: this
// }],
//loader:树节点的加载器,默认为Ext.tree.TreeLoader
loader: new Ext.tree.TreeLoader({
dataUrl: 'menu.action'// dataUrl:获取子节点的URL地址。
}),
//每加入进来的节点,若为非叶子节点则做为根节点继续进行查找
// root:树的根节点。
root: new Ext.tree.AsyncTreeNode({
text: '人力资源管理',
expanded :true,// expanded:是否展开节点,默认为false
id: '1' //加载数据时每次以变量node传入id的值如: node=1
//leaf: false //数据库中存储的为1/0
}),
listeners: {
'click': {
fn: this.clickNode,
scope: this
}
}
}]
},this.center,{
region: 'south',
width: '100%',
frame: true,
height: 30,
html: "<div id='author'>Copyright &copy 201204 TRJ1101 & 张勇</div>"
}]
});
}, center: new Ext.TabPanel({
id: 'mainTab',
frame: true,
region: 'center',
activeTab: 0,// 初始激活的tab,索引或者id值,默认为none,从0开始
autoScroll: false,
enableTabScroll : true, //溢出时滚动tab
split: true,
//TabCloseMenu一个显示右键菜单的插件
//添加编辑插件
plugins: new Ext.ux.TabCloseMenu(), items: [{
closable: false,// tab是否可关闭,默认为false
title: '首页',
iconCls: 'main',//css样式 html: '<iframe src="/hrmsys/jsp/first.jsp" frameborder=0 width=100% height=100%/>'
}]
}), /**
* 在中间区域添加新的面板
*/
addTab : function(nodeId, nodeUrl, nodeText, nodeIcon){
var tabId = 'tab_'+nodeId; //tabId为新建面板的id
var tabTitle = nodeText;
var tabUrl = nodeUrl;
var centerPanel = Ext.getCmp('mainTab');
var tab = centerPanel.getComponent(tabId);
if(parseInt(nodeId) == 28){
Ext.getCmp('mainTab').remove(Ext.getCmp('tab_30'));
}
if(parseInt(nodeId) == 30){
Ext.getCmp('mainTab').remove(Ext.getCmp('tab_28'));
}
//如果已存在此面板则只需要激活便可
if(!tab){
var newTab = centerPanel.add(//ADD方法添加组建
new Ext.Panel({
//bodyStyle: 'background-color:#dfe8f6;',
frame: true,
title: tabTitle,
iconCls: nodeIcon,
id: tabId,
closable: true
// listeners: {//监听激活事件设置页面大小
// active: this.activeTabSize,
// scope: this
// }
})
);
//激活新面板
centerPanel.setActiveTab(newTab);
//加载页面数据
newTab.load({
url: tabUrl,
method: 'post',
scope: this,
nocache : true, // 不缓存
timeout: 3000,
scripts : true //设置允许加载的页面执行js,很重要
});
}else{
centerPanel.setActiveTab(tab);
};
//this.juage(nodeId);
}, /**
* 树结点的单击事件
* 若为叶子节点则弹出一个窗口
*/
clickNode : function(node, e){
if(node.attributes.leaf){
var nodeId = node.attributes.id;
var nodeUrl = node.attributes.menuUrl;
var nodeText = node.attributes.text;
var nodeIcon = node.attributes.menuIcon;
this.addTab(nodeId, nodeUrl, nodeText, nodeIcon);
};
} /**
* 激活页面时设置页面大小
*/
// activeTabSize : function(){
// console.log('jin ru');
// var w = Ext.getCmp('mainTab').getActiveTab().getInnerWidth();
// var h = Ext.getCmp('mainTab').getActiveTab().getInnerHeight();
// var activeTabId = Ext.getCmp('mainTab').getActiveTab().id;
// var activeTab = Ext.getCmp('activeTabId');
// if(activeTab){
// activeTab.setHeight(h);
// activeTab.setWidth(w);
// }
// }
});

25.EXTJS 主页面的jsp的更多相关文章

  1. 权限模块_使用权限_实现主页面的效果_显示左侧菜单&只显示有权限的菜单项

    权限模块__使用权限__实现主页面的效果 HomeAction.java public class HomeAction extends ActionSupport { public String i ...

  2. Extjs中引入JSP页面

    有的时候,我们可能要在某个panel中动态的引入一个jsp页面.但是ext中貌似没有这样的方法,所以这时候需要我们自定义一个组件来完成我们的需求. 1.首先定义我们的penel. Ext.define ...

  3. Maven工程webinfo下面的JSP页面无法加载.js、.css文件的解决方案

    --下面是我的工程路径 --我jsp的写法 -----启动工程,访问js文件的路径是这样的, href="http://localhost:8080/activiti/css/public. ...

  4. WEB-INFO里面的jsp文件不能通过href 访问,而只能通过 servlet访问

    href="<%=basePath %>index.jsp"> 这种确实 可以在jsp页面跳转至另一个页面,只不过要放在WEB-INFO外面,也就是项目根目录下面 ...

  5. 19.Extjs主页面显示js

    1. /** * @author sux * @time 2011-1-11 * @desc main page */ var mainPage = Ext.extend(Ext.Viewport,{ ...

  6. 查看当前页面的jsp文件【我】

    方法一:可以通过看html类型的请求 方法二:对于有些嵌入的子页面,也可以通过,鼠标右键——此框架——查看框架源代码的方式,直接找到对应的jsp 直接就可以看到对应的jsp:

  7. WebContent的子目录里面的jsp文件无法将数据传递给Servlet

    在WebContent下创建子目录FormCheck,register.jsp将跳转到RegisterServlet这个Servlet中去 分两种情况:在web.xml里面配置 和 使用注解 1.在w ...

  8. 安卓Java主页面的编写

    1 package com.example.first; 2 3 import androidx.appcompat.app.AppCompatActivity; 4 5 import android ...

  9. phpcms 修改后台 主页面的模板

    代码在phpcms/modules/admin/templates/main.tpl.php 在该文件修改就可以修改 phpcms后台管理系统的 首页面.

随机推荐

  1. Python中的列表(3)

    我们创建的列表元素的顺序是无法预测的,因为我们无法控制用户提供数据的顺序. 为了组织列表中的元素,所以Python帮我们提供一些方法用来排序列表中的元素. 1.方法 sort() 可以对列表永久性排序 ...

  2. Far Relative’s Problem (贪心 计算来的最多客人)

    Description Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n  ...

  3. windows下mysql使用实录

    之前密码忘了,卸载重装,配置好环境变量,登录,成功 操作命令可参考http://www.runoob.com/mysql/mysql-tutorial.html 这里只列举了我需要用到的命令 登录:m ...

  4. mysql pager用法&命令行命令

    下面讲的命令,有部分只能在linux上才有.像pager命令windows上就没有了. 分屏:在Linux上,而且不是xwindow时,使用mysql命令行时,输出太多的东西,看不到就很悲剧了.在sh ...

  5. 博弈论入门题 kiki's game

    Problem Description Recently kiki has nothing to do. While she is bored, an idea appears in his mind ...

  6. Delphi简单的数据操作类

    unit MyClass; uses   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,   VCL ...

  7. Linux下keepalived下载安装与配置

    一.下载(原文链接:http://www.studyshare.cn/blog-front//software/details/1158/0 ) 网盘下载:https://pan.baidu.com/ ...

  8. spring mvc随便接收list<objeect>参数

    在后台设定一个类,PersonList类: public class PersonList {private List<User> user; public List<User> ...

  9. 搭建ELK收集PHP的日志

    架构: filebeat --> redis -->logstash --> es --> kibana 每个客户端需要安装filebeat收集PHP日志 filebeat把收 ...

  10. AngularJS $q 和 $q.all 单个数据源和多个数据源合并(promise的说明)

    这篇文章讲的不错, angular $q  和 promise!! -------------------------------------------------------------- 通过调 ...