1
{xtype : 'radiogroup',
            items : [{
                boxLabel : 'jjj',
                name : 'tyutrfytr',
                inputValue : 1,
                checked : true
            }, {
                boxLabel : 'kkk',
                name : 'dfdsfdsddd',
                inputValue : 2,
                listeners: {
                      check : function(cb, rec, ind) {
                            alert('hhhh');
                       }
                 }
            }]
}

上面的代码给出了alert我是按第一个选项还是第二个选项。它不应该仅在选中第二个选项时才发出警报吗?

4

2 回答 2

3

每当收音机被检查或未选中时,活动都会发射。

check : ( Ext.form.Checkbox this, Boolean checked ) 当复选框被选中或取消选中时触发。将使用以下参数调用侦听器: this : Ext.form.Checkbox 该复选框已选中 : Boolean 新的选中值

  listeners: {
                          check : function(cb, value) {
                                if (value) alert('check');
                                   else alert('uncheck');
                           }
                     }
于 2011-09-08T12:44:17.800 回答
1

此代码在 4.2 版中运行良好:

xtype: 'radiogroup',
id: 'RadioGroupId',
fieldLabel: 'The Radio Group',
items: [{
    xtype: 'radiofield',
    boxLabel: 'The first radio',
    id: 'FirstRadioId',
    name: 'radios',
    inputValue: 1,
    listeners: {
        change: function (cb, newValue, oldValue) {
            if (newValue) {
               // First radio button has been selected
            } else {
               // Second radio button has been selected
            }
        }
    }
}, {
    xtype: 'radiofield',
    boxLabel: 'The second radio',
    id: 'SecondRadioId',
    name: 'radios',
    inputValue: 2,
    checked: true
}]
于 2014-11-12T05:10:24.270 回答