先上代码,注意文中的红色字体
- var form = new Ext.form.FormPanel({
- autoHeight : true,
- id : 'reformId',
- frame:true,
- width : 400,
- border: false,
- height:300,
- labelWidth:60,
- items: [{
- layout:'column',
- border:false,
- items: [{
- layout:'form',
- border:false,
- columnWidth:.7, //在这里写columnWidth,注意位置
- items:[{
- xtype : 'textfield',
- fieldLabel: '学校名称',
- id:'_ent_name',
- readOnly:true,
- anchor:'100%', //在这里写anchor
- name:'entName',
- allowBlank:false
- }]
- },{layout:'form',
- border:false,
- columnWidth:.3,
- items:[{
- xtype:'button',
- text:'选择学校',
- name:'choiceEnt',
- anchor:'50%',
- listeners :{
- click :function(){
- choiceTarget();
- }
- }
- }]
- }]}
- ,{
- layout:'column',items:[{
- layout:'form',
- border:false,
- items:[accountGrid]
- },{
- layout:'form',
- border:false,
- items:[{
- xtype:'textarea',
- columnWidth:1,
- fieldLabel:'备注',
- msgTarget : 'under',
- width:300,
- height:80,
- name:'note',
- emptyText:'请填写相关备注信息'}]
- }
- ]
- }]
- });
看到了吧,如果一行中同一列有多个对象,就要用到columnWidth和anchor了,大家要注意它俩的位置,否则是出不了效果的。
本文转自sucre03 51CTO博客,原文链接:http://blog.51cto.com/sucre/890288,如需转载请自行联系原作者