一个Js页面 BtnToolBar.js 此页面是给toolbar自动加载按钮控件,通过BtnToolBar.jsp获取相关按钮信息MES= {version : '0.1'};
Ext.Toolbar.prototype.hiddenAllItems = function() {
this.items.each(function(item) {
if (item.hide) {
item.hide();
}
});
};
MES.BtnToolBar=function(obj, tree){
this.toolbar = obj;
if (this.toolbar) {
Ext.Ajax.request({
url : '/mis/wlcsp/rbac/BtnToolBar.jsp?DbType=check',
success : function(response, options) {
var responseArray = Ext.util.JSON.decode(response.responseText);
if (responseArray.success) {
obj.hiddenAllItems();
var strs= new Array(); //定义一数组
strs=responseArray.BtnName.split(',');//按钮数组
for(var i=0;i<strs.length;i++){
var strstemp= new Array(); //定义一数组
strstemp=strs[i].split(".");//每个数组中对应的多个信息
//加载按钮
LoadBtn(strstemp[0],strstemp[1]);
}
}else{
obj.hiddenAllItems();
}
}
});
}
//加载按钮方法
var LoadBtn = function(btnid,btnname) {
obj.add(new Ext.Button({
id:btnid,
text:btnname,
listeners:{click:BtnClick}
}));
};
var BtnClick = function(obj, e) {
obj.getId();
};
};另一个Js页面CustomerpoList.js,里面有一个方法
function SearchCustomerpoOp(){
dsCustomerpoList.proxy = new Ext.data.HttpProxy({
url:'CustomerpoListData.jsp?DbType=GetCustomerpo&CustomerID='+Ext.getCmp("txt_customername_customerposearch_id").getValue()+'&CustPO='+Ext.getCmp("txt_custpo_customerposearch_id").getValue()
});
dsCustomerpoList.load({params : {start : 0,limit : 30}});
}在main.js中有如下部分代码
var logInOut = new WLCSP.BtnToolBar(LoginTitleBar, tree);
var viewport = new Ext.Viewport({
layout : 'border',// 布局方式,'border'
items : [LoginTitleBar,StatusStrip,LeftMenu,MainTabPanel]
});我需要点击LoginTitleBar上的按钮,然后可以获取CustomerpoList.js页面中的方法
需要注意的,他们这几个页面都不在一起,是分布在多个文件夹下
Ext.Toolbar.prototype.hiddenAllItems = function() {
this.items.each(function(item) {
if (item.hide) {
item.hide();
}
});
};
MES.BtnToolBar=function(obj, tree){
this.toolbar = obj;
if (this.toolbar) {
Ext.Ajax.request({
url : '/mis/wlcsp/rbac/BtnToolBar.jsp?DbType=check',
success : function(response, options) {
var responseArray = Ext.util.JSON.decode(response.responseText);
if (responseArray.success) {
obj.hiddenAllItems();
var strs= new Array(); //定义一数组
strs=responseArray.BtnName.split(',');//按钮数组
for(var i=0;i<strs.length;i++){
var strstemp= new Array(); //定义一数组
strstemp=strs[i].split(".");//每个数组中对应的多个信息
//加载按钮
LoadBtn(strstemp[0],strstemp[1]);
}
}else{
obj.hiddenAllItems();
}
}
});
}
//加载按钮方法
var LoadBtn = function(btnid,btnname) {
obj.add(new Ext.Button({
id:btnid,
text:btnname,
listeners:{click:BtnClick}
}));
};
var BtnClick = function(obj, e) {
obj.getId();
};
};另一个Js页面CustomerpoList.js,里面有一个方法
function SearchCustomerpoOp(){
dsCustomerpoList.proxy = new Ext.data.HttpProxy({
url:'CustomerpoListData.jsp?DbType=GetCustomerpo&CustomerID='+Ext.getCmp("txt_customername_customerposearch_id").getValue()+'&CustPO='+Ext.getCmp("txt_custpo_customerposearch_id").getValue()
});
dsCustomerpoList.load({params : {start : 0,limit : 30}});
}在main.js中有如下部分代码
var logInOut = new WLCSP.BtnToolBar(LoginTitleBar, tree);
var viewport = new Ext.Viewport({
layout : 'border',// 布局方式,'border'
items : [LoginTitleBar,StatusStrip,LeftMenu,MainTabPanel]
});我需要点击LoginTitleBar上的按钮,然后可以获取CustomerpoList.js页面中的方法
需要注意的,他们这几个页面都不在一起,是分布在多个文件夹下
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货