2

我对 ExtJs 很陌生,我想在单击其中一个单选按钮时显示一个警告框,但它似乎不起作用。谁能指导我完成这一步?侦听器似乎不起作用。

{
    xtype: 'radiogroup',
    fieldLabel: 'Does Nodes have DHCP IP Scheme?',
    id:'dhcpRadio',
    columns: [50, 50],
    // Arrange radio buttons into two columns, distributed vertically
    columns: 2,
    vertical: true,
    items: [{
    boxLabel: 'Yes',
        name: 'rb', 
        inputValue: 'yes',
        listeners: {
            check: function(rb,value){
                if(value=='yes') 
                    alert('yes');
                else alert('no');
            }
        }
    },{
        boxLabel: 'No',
        name: 'rb',
        inputValue: 'no',
        checked: true
    }]
}
4

2 回答 2

2

就像 Gregory 刚才所说的那样,Radio 没有click活动。你可以试试这个change事件:

listeners: {
    change : function(rb, newValue, oldValue, options) {
        if( newValue === 'yes') {
            alert('Yes')
        } else {
            alert('No')
        }
    }
}

有关详细信息,请参阅API 文档

于 2011-09-30T08:33:50.147 回答
0

收音机没有点击事件

而不是听众试试这个:

handler: function(ctl, val) {
  alert("ddd");
}
于 2011-09-30T04:07:13.780 回答