javascript - 如何用 ExtJS 监听单选按钮是否被选中?

标签 javascript extjs radio-group

{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。它不应该只在选中第二个选项时才发出警报吗?

最佳答案

每当 radio 被选中或未被选中时,事件就会触发。

check : ( Ext.form.Checkbox this, Boolean checked ) 选中或取消选中复选框时触发。 将使用以下参数调用监听器: 这个:Ext.form.Checkbox 这个复选框 检查: bool 值 新勾选值

  listeners: {
                          check : function(cb, value) {
                                if (value) alert('check');
                                   else alert('uncheck');
                           }
                     }

关于javascript - 如何用 ExtJS 监听单选按钮是否被选中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7348065/

相关文章:

android - 以编程方式选中的 RadioButton 不会取消选中

php - 没有 AJAX 的 HTML5 拖放是可能的吗?

javascript - 我怎样才能让这个 flexbox 扩展它的 flex 元素?

javascript - 本地和远程数据源到 Kendo Treeview

javascript - 从 JS 脚本创建一个可嵌入的 "widget"

javascript - 在 Itemselector extJS 中拖放

javascript - Extjs + PHP 通过增加 Java 堆大小来增强性能

extjs - ExtJs 5 上的全局 View + ViewController

android - 循环通过 Radiogroup 以对 Radiobutton 标签执行操作

android - 当在同一 Activity 中再次使用 radio 组时,重置我选中的 radio 组