com.rm.HomePagePanel = Ext.extend(Ext.Panel, {
layout : 'absolute',
border : false,
autoScroll : true,
defaults : {
collapsible : true,
draggable : {
insertProxy : false,
onDrag : function(e) {
var pel = this.proxy.getEl();
this.x = pel.getLeft(true);
this.y = pel.getTop(true);

if(this.x < 0){
this.x = 100;
}
if(this.y <0){
this.y = 50;
}
var s = this.panel.getEl().shadow;
if (s) {
s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
}
},
endDrag : function(e) {
this.y = this.y;
if(this.y < 115){
this.y = 115;
}
this.x = this.x;
if(this.x < 250){
this.x = 250;
}
this.panel.setPosition(this.x-250, this.y-115);
}
}
},
initComponent : function(){
com.rm.HomePagePanel.superclass.initComponent.call(this);
var server = new Ext.Panel({
title : 'abc',
layout:'fit',
width : 200,
height : 250,
x : 50,
y : 30,
items : this.getWebList()
});
var web = new Ext.Panel({
title : abc',
width : 200,
layout:'fit',
height : 250,
x : 300,
y : 30
});
var app = new Ext.Panel({
title : 'abc',
width : 200,
layout:'fit',
height : 250,
x : 550,
y : 30
});
var db = new Ext.Panel({
title : 'abc',
width : 200,
layout:'fit',
height : 250,
x : 800,
y : 30
});
var tran = new Ext.Panel({
title : 'abc',
width : 200,
layout:'fit',
height : 250,
x : 50,
y : 310
});
        this.add(server);
this.add(web);
this.add(app);
this.add(db);
this.add(tran);

},
getWebList : function(){
var record = new Ext.data.Record.create([
{name : 'monitorId'},
{name : 'monitorName'},
{name : 'monitorIp'},
{name : 'desc'},
{name : 'monitorType'}
]);
var store = new Ext.data.JsonStore({
url : 'oracle/oracleMonitorList_list.action',
fields : record,
root : 'data',
totalProperty : 'totalProperty',
baseParams : [{type : 'oracle'}]
});
var cm = new Ext.grid.ColumnModel(
/*[
new Ext.grid.RowNumberer(),
{header : 'monitorName',dataIndex : 'monitorName',width : 172,align : 'left',renderer:this.form,listeners :{click : this.open}}
]*/
{
defaults : {width : 172,align : 'left'},
columns : [{
dataIndex : 'monitorName',
renderer : function(value, metaData, record, rowIndex, colIndex, store){
return String.format('<span style=cursor:hand qtip="{0}"><img src="/runmonitor/images/{1}.gif"/>{2}</span>',record.get('desc'),record.get('monitorType'),record.get('monitorName'))
},
listeners : {click : this.open}
}
]
//renderer : this.form,
//listeners : { click : this.open()}
}

);
var pageBar = new Ext.PagingToolbar({
pageSize : 10,
store : store,
displayInfo : true
});
var grid = new Ext.grid.GridPanel({
hideHeaders : true,
border : false,
store : store,
bbar : pageBar,
cm : cm

});
store.load();
return grid;
},
/* form : function(val){
if(val != "")
return String.format('<span style=cursor:hand qtip="{0}"><img src="/runmonitor/images/linux.gif"/>{0}</span>',val);
},*/
open : function(column, gird,rowIndex, e){
//alert(rowIndex);
Ext.getCmp('rightPanel').removeAll();
Ext.getCmp('rightPanel').add(new com.rm.MonitorPagePanel());//如何向MonitorPagePanel传递一些参数
Ext.getCmp('rightPanel').doLayout();
}
});
Ext.reg('HomePage',com.rm.HomePagePanel);
////////////////////////////////////////////////////////////////////////////////////////////////////////////
com.rm.MonitorPagePanel = Ext.extend(Ext.Panel,{
layout : 'fit', 
initComponent : function(){
com.rm.MonitorPagePanel.superclass.initComponent.call(this);
var panel = new Ext.Panel({
title : 'panel',
width : 200,
height : 400
});

        
this.add(panel);
},
test : function(){
 alert(rowIndex);
}

});
Ext.reg('MonitorPagePanel',com.rm.MonitorPagePanel);/////////////////////////////////////////////////////////////////////////////
另外,这切换的页面挺多,怎么动态生成啊,动态的加载  new com.rm.******()
open : function(column, gird,rowIndex, e){
//alert(rowIndex);
Ext.getCmp('rightPanel').removeAll();
Ext.getCmp('rightPanel').add(new com.rm.MonitorPagePanel()); Ext.getCmp('rightPanel').doLayout();
}

解决方案 »

  1.   

    我觉得可以用两种方式:一种是创建个html元素,然后在A页面将值存到里面,然后再到B页面去取
    第二种就是:改变写法,把js写成function的形式,如 a = function(config){...}
    把值存到存到config对象里面,然后调用另外一个页面时,直接通过 var temp = config.xx 取就行了
      

  2.   

    谢了,我在html页面写了一个Js变量,然后在不同的页面访问。
    ,能再教你个问题吗切换的页面挺多,怎么动态生成啊,动态的加载 new com.rm.******()open : function(column, gird,rowIndex, e){
    //alert(rowIndex);
    Ext.getCmp('rightPanel').removeAll();
    Ext.getCmp('rightPanel').add(new com.rm.MonitorPagePanel());
    Ext.getCmp('rightPanel').doLayout();
    }
      

  3.   

    Ext.getCmp('rightPanel').add(Ext.create({mIp : '192.168.1.1'},'MonitorPagePanel'));
    com.rm.MonitorPagePanel = Ext.extend(Ext.Panel,{
    layout : 'fit', 
    mIp : '',
    解决了