问题描述
我有一个复选框组和一个广播组。对于他们两个,我都想抓住几个价值。
对于checkboxGroup
I have a checkboxgroup and a radiogroup. For both of them, I want to catch several values. For the checkboxGroup
var DescCheck = new Ext.form.CheckboxGroup({
fieldLabel: 'Description of service : <span style="color: rgb(255, 0, 0); padding-left: 2px;">*</span>',
width : 540,
labelSeparator : '',
items: [
{boxLabel: 'Direct', name: 'Direct', inputValue: 'Direct'},
{boxLabel: 'Fixed-day', name: 'day', inputValue: 'Fixed'},
{boxLabel: 'Weekly', name: 'Weekly', inputValue: 'Weekly'}
]
});
我尝试了 DescCheck.getValue()
但它返回了我
我尝试了 DescCheck.getValue()。inputValue
,它什么也没给我返回。
I tried DescCheck.getValue().inputValue
and it returned me nothing.
对于radioGroup p>
For the radioGroup
var TypeCheck = new Ext.form.RadioGroup({
items: [
{boxLabel: 'New 1', name: '1', inputValue: '1'},
{boxLabel: 'New 2', name: '2', inputValue: '2'},
{boxLabel: 'New 3', name: '3', inputValue: '3'}
]
我尝试了 TypeCheck.getValue()。inputValue
,但是它只返回了第一个选定的项目。如何捕获多个复选框?
I tried TypeCheck.getValue().inputValue
but it returned only the first selected item. How can I catch several checked boxes?
推荐答案
您是否尝试过来获取所有复选框。
Did you tried getChecked for getting all checked boxes.
DescCheck.getChecked();
更新
您应该使用 getValue()
,它返回所选值的数组。
You should use getValue()
, It returns the array of selected values.
可以通过像这样遍历整个数组
You can get that by looping through array like this
var selectedValue = DescCheck.getValue();
for(var i=0;i<selectedValue.length;i++){
console.log(select[i].inputValue);
}
这篇关于获取CheckboxGroup(或RadioGroup)值[EXTJS 3.4]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!