您的位置:首页 > Web前端 > JavaScript

ExtJs 中获取 radiobutton 的值

2015-08-27 19:33 585 查看
ExtJs中使用radiobutton,想在ExtJs本身代码中(注意,不是在后台喔)获取 radioButton 的值,居然发现很难,无从下手的感觉。后来在网上寻寻觅觅,痛苦摸索之后,真是大跌眼镜。

代码如下:

{
xtype: 'fieldcontainer', layout: { type: 'column' }
, items: [
{
xtype: 'radiogroup', fieldLabel: '统计方式', id: 'rdTjType', name: 'TjType'
, columnWidth: 0.5
, items: [
{ boxLabel: '按行政区域', name: 'TjType', inputValue: 'qhid', checked: true }
, { boxLabel: '按年份', name: 'TjType', inputValue: 'year' }
]
, listeners: {
'change': function (group, newV, oldV, e) {
//看到没,获得radiobuttongroup的选中值,居然是属性“TjType”!这个属性并不是ExtJs固有的,而是根据我们设置的radiobutton的name来相应设置的。并不是什么newV.inputValue!真是匪夷所思
var type = newV.TjType;
setTongJiParam(type);
}
}
}
]
}


ExtJs一般给人的感觉就是很笨重,界面好像也很难修改;它大包大揽,除了语法还是javascript + json,好多东西都需要开发者猛查资料才明白,更遑论这些匪夷所思的小地方了。疯狂。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: