选择视图中的所有复选框

发布于 2024-12-24 17:23:02 字数 86 浏览 1 评论 0原文

我在页面中有一个从 JSON 动态生成的复选框列表。我还需要一个“全选”复选框。我怎样才能实现这个目标?如何一起选择所有复选框并将它们全部设置为在代码中选中?

I have a list of check boxes in a page, dynamically generated from a JSON. I need a 'select all' check box also. How can I achieve this? How to select all check boxes together and set them all checked in code ?

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

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

发布评论

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

评论(2

丿*梦醉红颜 2024-12-31 17:23:02

只需进行一个布尔字段检查,然后在全选按钮/复选框上将其设置为 true,并通过通知列表专家的数据集更改来重绘列表。

在列表专家中检查“检查”标志是否为真,然后检查复选框...

Just take one Boolean field check and on select all button/check box set it true and redraw list by notify data set change for list adepter .

On list adepter check if "check " flag is true then check the check box ...

挽清梦 2024-12-31 17:23:02

我将保留一个复选框列表: List; allMyCheckboxes

构建复选框列表时,将每个复选框添加到此列表中。然后,全选复选框的事件将设置此列表中所有复选框的值。

I would mantain a List of checkboxes: List<Checkbox> allMyCheckboxes.

When building the list of checkboxes add each one to this list. Then the event for the select all checkbox would set the values for all the check boxes in this list.

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