以下是代码全文,目的是左边的West点击树的节点后,在center区域显示已经定义好的panel的内容。不需要做动态的,很简单的问题,有高手帮忙下小弟么~~不胜感激!!!Ext.onReady(function(){
var tree;
var center = new Ext.Panel(
{ region:"center", 
title:"中央面板"
})
var buttom = new Ext.Toolbar({
region:"south", 
height:50, 
title:"底部面板"
})
var root = new Ext.tree.AsyncTreeNode({
  id:"0",
  text:"根菜单",
  loader:loader});
var west=new Ext.tree.TreePanel({
  title:"菜单",
  width:200,
  autoScroll : true,
    animate : true,
    singleExpand:false,
    rootVisible:false,
enableDD : false,
containerScroll : true,
  region:"west",
  collapsible:true,
  split:true,
  collapsed : false,
  minSize : 175,
    maxSize : 500,
  root:root
 });
tree.addListener("click",clickTreeNode);
function clickTreeNode(){
var form=new Ext.form.FormPanel({
region:'center',
labelWidth:80,
frame:true,
autoScroll:true,
items:[{
xtype:'fieldset',
title:'机械表基本信息',
layout:'column',
items:[
{//表单的第一个子表单
columnWidth:0.25,
layout:'form',
items:[{
xtype:'hidden',
name:'auto_id'
},
{
xtype:'textfield',
name:'LICENSE_NO',
fieldLabel:'证书号',
maxLength:20,
maxLengthText:'证书号只能输入20个字符!'
},
{
xtype:'datefield',
name:'valid_DATE',
fieldLabel:'证书有效日期',
format:'Y-m-d H:i',
menu:new DatetimeMenu(),
maxValue:value,
allowBlank:false
}]},
//表单的第二个子表单
{
xtype:'fieldset',
title:'表具基本信息',
layout:'column',
items:[{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'textfield',
name:'METER_ID',
fieldLabel:'表具编号',
allowBlank:false,
anchor:'95%',
maxLength:20,
maxLengthText:'表具编号只能输入20个字符!'
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
fieldLabel:'气表类型',
name:'METER_TYPE',
anchor:'95%',
allowBlank:false,
text:N,
readOnly:true,
triggerAction:'all',
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
fieldLabel:'表具容量',
name:'METER_CAPACITY',
anchor:'95%',
text:N,
allowBlank:false,
readOnly:true,
triggerAction:'all',
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
fieldLabel:'表等级',
name:'METER_GRADE',
text:N,
anchor:'95%',
allowBlank:true,
readOnly:true,
triggerAction:'all',
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
text:N,
allowBlank:true,
name:'METER_INTERFACE',
fieldLabel:'表向',
text:N,
maxLength:4,
maxLengthText:'只能输入4位数的数字!',
anchor:'95%'
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'numberfield',
name:'lastReading',
fieldLabel:'表初始值',
allowBlank:false,
minValue:0,
maxLength:8,
maxLengthText:'只能输入8位数的数字!',
anchor:'95%'
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'numberfield',
name:'DIAMETER',
fieldLabel:'口径',
maxLength:50,
maxLengthText:'只能输入50个字符!',
anchor:'95%'
}]
}
]},
{
xtype:'fieldset',
title:'厂家信息',
layout:'column',
items:[{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
text:N,
allowBlank:true,
name:'METER_VENDOR',
fieldLabel:'生产厂家',
anchor:'95%'
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'datefield',
fieldLabel:'出厂日期',
name:'BUY_DATE',
anchor:'95%',
format:'Y-m-d H:i',
menu:new DatetimeMenu(),
maxValue:value,
allowBlank:false,
readOnly:true,
triggerAction:'all',
typeAhead: false
}]
},
{
xtype:'fieldset',
title:'其他',
layout:'column',
items:[
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'datefield',
name:'USE_DATE',
fieldLabel:'首次领用日期',
anchor:'95%',
menu:new DatetimeMenu(),
maxValue:value,
allowBlank:false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'TextField',
fieldLabel:'检修周期(月)',
name:'CHECK_PERIOD',
maxLength:3,
maxLengthText:'证书号只能输入3位数的数字!',
text:120,
anchor:'95%',
allowBlank:true,
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'checkbox',
fieldLabel:'远传系统',
name:'REMOTE_CONTROL_SYSTEM',
boxLabel:'(√是/否)',
checked:true,
anchor:'95%',
allowBlank:true,
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'checkbox',
fieldLabel:'是否有修正仪',
name:'IS_BILL',
boxLabel:'(√是/否)',
checked:true,
anchor:'95%',
allowBlank:true,
typeAhead: false
}]
},
{
xtype:'fieldset',
title:'修正仪信息',
layout:'column',
items:[{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'NumberField',
name:'mod_auto_ID',
anchor:'95%'
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'TextField',
fieldLabel:'修正仪编号',
maxLength:20,
maxLengthText:'修正仪编号只能输入20个字符!',
name:'METER_ID_mod',
anchor:'95%',
allowBlank:false,
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
text:N,
allowBlank:false,
fieldLabel:'修正仪类型',
name:'METER_TYPE_mod'
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
fieldLabel:'修正仪规格',
name:'METER_CAPACITY_mod',
anchor:'95%',
text:N,
allowBlank:false,
typeAhead: false
}]
},{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
fieldLabel:'生产厂家',
name:'METER_VENDOR_mod',
anchor:'95%',
text:N,
allowBlank:true,
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'datefield',
fieldLabel:'出厂日期',
name:'BUY_DATE_mod',
anchor:'95%',
menu:new DatetimeMenu(),
minValue:value,
allowBlank:false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'combo',
fieldLabel:'修正仪规格',
name:'METER_CAPACITY_mod',
anchor:'95%',
text:N,
allowBlank:true,
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'numberfield',
fieldLabel:'修正仪初始值',
name:'lastReading_mod',
anchor:'95%',
minValue:0,
maxLength:8,
maxLengthText:'修正仪参数只能输入8个字符!',
allowBlank:false,
typeAhead: false
}]
},
{
columnWidth:0.25,
layout:'form',
items:[{
xtype:'TextField',
fieldLabel:'检修周期',
name:'CHECK_PERIOD_mod',
anchor:'95%',
text:120,
maxLength:3,
maxLengthText:'修正仪检修月数只能输入3位数的数字!',
allowBlank:false,
typeAhead: false
}]
}]
}
]
}
]
}
]
}]

});
}
new Ext.Viewport({
layout:"border",
renderTo:document.body,
items:[west,center,buttom]
})
}
)