extjs2.2中加入了新的组件new Ext.form.RadioGroup和new Ext.form.CheckBoxGroup,这样可以解决以前radio,checkbox组件排版弊端,也可以简洁,隐藏fieldLabel的两种方法:hideLable:true和不给fieldLabel属性并设labelSeparator:"",建议使用后者,
var serviceType = new Ext.form.RadioGroup({
width : 220,
hideLabel:true,
style:'margin-left:100px;',
columns : 1,
vertical :true,
items:[
{boxLabel:'本地业务',inputValue:'local',name:'sevType'},
{boxLabel:'点对点业务',inputValue:'p2p',name:'sevType',
listeners:{
check:function(el,checked){
if(checked){
//插入一项
makePointWay();
}else{
//删除一项
removePointWay();
}
}
}
}]
});
这两个参数可以控制排版,以一列竖型排布。
由于radiogroup没有check事件,可以用radio的check事件,通过这个事件去得到选中,然后就可以去判断了.
有一个问题,就是inputValue的值,在form的submit方法,和load方法都是可以取得和提交正确的值(根据你的inputValue设定的值),但是在本js中要取inputValue的值。好像只能用BasicForm中的getValues()方法,才能取到,原因还不清楚,先取到值再说。
service_FORM.getForm().submit({
url:url,
method:'post',
waitMsg:"提交中",
params: {
appid:top.appid
},
failure:UI2.formSubmitFailed,
success:function(form,action){
//取业务类型的值,去判断跳转到那个页面
var dbtypevalue = form.getValues().sevType;
if(dbtypevalue =='local'){
top.dbtype = 'local';
document.location.href = "dbsync-wiz/localdbsync-wiz.jsp";
}else if(dbtypevalue =='p2p'){
var pointwayvalue = Ext.getCmp('pointToPointWayId').getValue();
if(pointwayvalue=='src')
{
document.location.href="dbsync-wiz/point-to-point-src.jsp";
}else{
document.location.href="dbsync-wiz/point-to-point-tag.jsp";
}
}
},
var serviceType = new Ext.form.RadioGroup({
width : 220,
hideLabel:true,
style:'margin-left:100px;',
columns : 1,
vertical :true,
items:[
{boxLabel:'本地业务',inputValue:'local',name:'sevType'},
{boxLabel:'点对点业务',inputValue:'p2p',name:'sevType',
listeners:{
check:function(el,checked){
if(checked){
//插入一项
makePointWay();
}else{
//删除一项
removePointWay();
}
}
}
}]
});
这两个参数可以控制排版,以一列竖型排布。
由于radiogroup没有check事件,可以用radio的check事件,通过这个事件去得到选中,然后就可以去判断了.
有一个问题,就是inputValue的值,在form的submit方法,和load方法都是可以取得和提交正确的值(根据你的inputValue设定的值),但是在本js中要取inputValue的值。好像只能用BasicForm中的getValues()方法,才能取到,原因还不清楚,先取到值再说。
service_FORM.getForm().submit({
url:url,
method:'post',
waitMsg:"提交中",
params: {
appid:top.appid
},
failure:UI2.formSubmitFailed,
success:function(form,action){
//取业务类型的值,去判断跳转到那个页面
var dbtypevalue = form.getValues().sevType;
if(dbtypevalue =='local'){
top.dbtype = 'local';
document.location.href = "dbsync-wiz/localdbsync-wiz.jsp";
}else if(dbtypevalue =='p2p'){
var pointwayvalue = Ext.getCmp('pointToPointWayId').getValue();
if(pointwayvalue=='src')
{
document.location.href="dbsync-wiz/point-to-point-src.jsp";
}else{
document.location.href="dbsync-wiz/point-to-point-tag.jsp";
}
}
},