Ext JS 中的单选框 Ext.form.Radio 添加点击事件
我有一个简单的单选按钮:
new Ext.form.Radio({
id: 'ptype',
boxLabel:'Yes',
name: 'price_type',
value: 1
})
但是我在添加单击事件时遇到问题。 我通常使用:
listeners: {
click: function (a,e) {
//event
}
}
作为配置参数,但在这种情况下它似乎不起作用。
任何建议表示赞赏,谢谢。
I have a simple radio button:
new Ext.form.Radio({
id: 'ptype',
boxLabel:'Yes',
name: 'price_type',
value: 1
})
However Im having trouble adding a on click event ot it.
I usually use:
listeners: {
click: function (a,e) {
//event
}
}
As a config parameter, however it does not seem to work in this case.
Any advice appreciated, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
单选按钮和复选框没有单击事件 - 我相信您想要 检查 事件。您的侦听器应如下所示:
请注意 handler config 是一个方便的快捷方式(也可以在按钮上使用)。您可以这样做,而不是侦听器语法:
Radio and checkboxes do not have a click event -- I believe you want the check event instead. Your listener should look like:
Note that the handler config is a handy shortcut for this (also available on buttons). Instead of the listeners syntax you could just do this:
试试这个:
Try this:
如果您使用的是 CheckBoxGroup,则应该执行类似的操作以确保您在正确的 Radio 上触发。
If you're using a CheckBoxGroup, you should do something like this to make sure you are firing on the correct Radio.