我有一些网格布局格式的 selectBooleanCheckboxes。我想获得这些复选框的集合:我不想将它们单独绑定到支持 bean,因为它们将彼此相关。有办法做到这一点吗?每个复选框都是单独的,但我想获取这些 UI 组件的 ArrayList,然后找出其中哪些被选中,哪些未被选中。也许我可以使用一个组属性来实现此目的?在这个时间敏感的问题上,我们非常感谢任何帮助。感谢您的阅读。
I have a few selectBooleanCheckboxes in a grid layout format. I would like to get a collection of these checkboxes: I don't want to bind them individually to a backing bean as they will be related to each other. Is there anyway to do this? Each checkbox is separate, but I would like to for instance get an ArrayList of these UI Components, and then figure out which of them is selected and which isn't. Maybe there is a group attribute I can use for this? Any help highly appreciated in this time-sensitive matter. Thank you for reading.
发布评论
评论(1)
尝试访问它们的父容器(其中包含您的复选框 - 例如 panelGroup1 容器 -> getPanelGroup1()...)并通过 getChildren() (或类似的东西)访问容器子容器,并且您应该获取所有子容器(包括你的复选框)。也许您会得到的不仅仅是复选框,但您可以循环遍历所有子项并识别您的复选框。另外,您的复选框可能在雇佣关系中更深,但您也可以使用相同的原则来访问孩子的孩子。
Try to access their parent container (where your checkboxes are contained - for example panelGroup1 container -> getPanelGroup1()...) and access containers children via getChildren() (or something like that), and you should get all children (including your checkboxes). Probably you'll get more than checkboxes only , but you can loop throught all children and recognize your checkboxes. Also , it is possible that your checkboxes are deeper in hirerachy , but you can use same principle to access childrens children too.