选择视图中的所有复选框
我在页面中有一个从 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需进行一个布尔字段检查,然后在全选按钮/复选框上将其设置为 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 ...
我将保留一个复选框列表:
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.