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]
});