获取选中的复选框值

发布于 2024-12-26 06:55:22 字数 68 浏览 4 评论 0原文

我有一个带有复选框的煎茶网格。 我需要获取选定的复选框值。 您能否建议我如何做或向我发送一段代码以在我选择复选框时获取值。

I have a sencha grid with checkbox.
I need to get a selected checkbox values.
Could you please suggest me on how to do or send me a piece of code to get the values when i select a checkbox.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深居我梦 2025-01-02 06:55:22

如果选中或未选中,此调用将返回 true 或 false,您必须将复选框 id 放在引号中:

Ext.getCmp("yourCheckBoxId").checked;

如果您想在选中时执行某些操作,则必须在复选框配置中添加侦听器:

{
    xtype: checkbox,
    ... //other config options
    listeners: {
        check: function(checkbox, value){
           if (value) {
              alert('You checked the checkbox!');
           } else {
              alert('You unchecked the checkbox.');
           }
        }
    },
}

Don如果这对您有用,请不要忘记“接受”答案(勾选左侧的标记)

This call will return true or false if it is checked or not, you would have to put your checkbox id in the quotes:

Ext.getCmp("yourCheckBoxId").checked;

If you want to do something the moment it gets checked you would have to add a listener in the checkbox config:

{
    xtype: checkbox,
    ... //other config options
    listeners: {
        check: function(checkbox, value){
           if (value) {
              alert('You checked the checkbox!');
           } else {
              alert('You unchecked the checkbox.');
           }
        }
    },
}

Don't forget to "accept" the answer if this works out for you (check mark at the left)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文