Ext 如何获取radio的值?
时间:2011-06-29
来源:互联网
有如下代码:
{
id:'ipmac_mod',
xtype: 'panel',
layout: 'table',
fieldLabel: '模式',
defaultType: 'radio',
isFormField: true,
items:
[
{
id: 'type_local',name:'user_type',boxLabel: '模式1',value:'F',checked:editdata.data[0]['close_radius'],
listeners:
{
check: function(radio,checked)
{
if(checked == true)
{
Ext.getCmp('radius').hide();
Ext.getCmp('local').show();
}
}
}
},
{
id: 'type_radius',name:'user_type',boxLabel:'模式2',value:'D',checked:editdata.data[0]['open_radius'],
listeners:
{
check: function(radio,checked)
{
if(checked == true)
{
Ext.getCmp('local').hide();
Ext.getCmp('radius').show();
}
}
}
}
]
}
如何获得user_type 的值?其实是两个单选框 ;用Ext.getCmp("user_type").getValue() 不行;
{
id:'ipmac_mod',
xtype: 'panel',
layout: 'table',
fieldLabel: '模式',
defaultType: 'radio',
isFormField: true,
items:
[
{
id: 'type_local',name:'user_type',boxLabel: '模式1',value:'F',checked:editdata.data[0]['close_radius'],
listeners:
{
check: function(radio,checked)
{
if(checked == true)
{
Ext.getCmp('radius').hide();
Ext.getCmp('local').show();
}
}
}
},
{
id: 'type_radius',name:'user_type',boxLabel:'模式2',value:'D',checked:editdata.data[0]['open_radius'],
listeners:
{
check: function(radio,checked)
{
if(checked == true)
{
Ext.getCmp('local').hide();
Ext.getCmp('radius').show();
}
}
}
}
]
}
如何获得user_type 的值?其实是两个单选框 ;用Ext.getCmp("user_type").getValue() 不行;
作者: shrimpma 发布时间: 2011-06-29
加入以下代码
JScript code
在页面提交表单时就有值了
JScript code
Ext.override(Ext.form.RadioGroup, { getValue: function(){ var v; if (this.rendered) { this.items.each(function(item){ if (!item.getValue()) return true; v = item.getRawValue(); return false; }); } else { for (var k in this.items) { if (this.items[k].checked) { v = this.items[k].inputValue; break; } } } return v; }, setValue: function(v){ if (this.rendered) this.items.each(function(item){ item.setValue(item.getRawValue() == v); }); else { for (var k in this.items) { this.items[k].checked = this.items[k].inputValue == v; } } } });
在页面提交表单时就有值了
作者: sainer 发布时间: 2011-06-29
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28