获取CheckboxGroup(或RadioGroup)值[EXTJS 3.4]

So4*_*4ne 0 checkbox extjs

我有一个checkboxgroup和一个radiogroup.对于他们两个,我想要抓住几个值.对于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'}
    ]
});
Run Code Online (Sandbox Code Playgroud)

我试过DescCheck.getValue()但它还给了我

[对象]

我试过了DescCheck.getValue().inputValue,它什么也没归我.

对于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'}
    ]
Run Code Online (Sandbox Code Playgroud)

我试过TypeCheck.getValue().inputValue但它只返回了第一个选中的项目.我怎样才能抓住几个复选框?

Vis*_*swa 5

您是否尝试过getChecked以获取所有复选框.

DescCheck.getChecked();
Run Code Online (Sandbox Code Playgroud)

更新

您应该使用getValue(),它返回所选值的数组.

你可以通过像这样循环遍历数组来实现

var selectedValue = DescCheck.getValue();

for(var i=0;i<selectedValue.length;i++){
    console.log(select[i].inputValue);
}
Run Code Online (Sandbox Code Playgroud)