Get CheckboxGroup (or RadioGroup) Values ​​[EXTJS 3.4]

I have a checkbox group and a radio group. For both of them, I want to catch a few meanings. For 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'}
    ]
});

I tried DescCheck.getValue(), but he returned me

[object of object]

I tried DescCheck.getValue().inputValue, and he gave me nothing.

For the radio group

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'}
    ]

I tried TypeCheck.getValue().inputValue, but it returned only the first selected item. How can I catch a few marked boxes?

0
source share
1 answer

You tried getChecked to get all the marked mailboxes.

DescCheck.getChecked();

Update

You must use getValue(), it returns an array of selected values.

, ,

var selectedValue = DescCheck.getValue();

for(var i=0;i<selectedValue.length;i++){
    console.log(select[i].inputValue);
}
+5

Source: https://habr.com/ru/post/1779004/


All Articles