extjs2.0好像不支持单选框组,因此用两个name相同单选框来实现单选框组
var radio1 = new ext.form.radio({boxlabel:'男',name:'sex',id:'yes',inputvalue:'0',width : 150, height : 20});
var radio2 = new ext.form.radio({boxlabel:'女',name:'sex',id:'no',inputvalue:'1', width : 150,height : 20});
//性别配置fieldset
var fieldset = new ext.form.fieldset({
title : '性别配置',
autoheight : true,
width : 350,
labelalign : 'right',
labelwidth : 110,
bodystyle : 'padding:5px 5px 0',
layout:'column',
items : [{
columnwidth : .5,
items:radio1 //radio1一定要写在单独的items里面,不然在页面显示的效果就是两个单选框的圆圈在前面,两个单选框选项的描述在后面
},
{
columnwidth : .5,
items: radio2
}]
});
var fp = new ext.formpanel({
id : 'sex_mode',
labelwidth : 110,
waitmsg : '正在提交,请稍后...',
frame : true,
width : 380,
autoheight : true,
layout:'column',
items : [fieldset]
});
var winkey = new ext.window({
id : sex_win,
title : '[性别]维护',
autoheight :true,// 320,
width : 400,
closeaction : 'hide',
closable:false,
iconcls : 'add',
modal : true,
buttons : [{
text : '提交',
id : 'button',
handler : function() {
var sex = fp.form.findfield(sex).getgroupvalue();
if(sex != '' && sex != undefined && sex != null){
fp.form.submit({
url : '', //配置性别的方法
waittitle : [性别]修改,
waitmsg : '正在提交数据,请稍后... ...',
success : function(form, action) {
ext.messagebox.alert('提示信息',action.result.msg);
},
failure : function(form, action) {
ext.messagebox.alert('提示信息', 更新性别有误!);
}
});
}else{
hs.util.msg('提示信息', '请选择性别!');
}
}
}],
items : [fp]
});
以上就是extjs2.0里ext.form.radio水平排列布局的详细内容。