0 Replies Latest reply on Sep 29, 2011 4:51 AM by cravi

    select all checkboxes of a rich tree node

    cravi

      Hey guys,

       

       

      I know that this is a well discussed topic but I didn't find a satisfing solution.

      So at the moment my page is showing a rich tree with two levels. Each of its nodes contains a checkbox and a output text.

      The issue is after selecting the checkbox of a parent node, all children checkboxes should be also selected. In the opposite if a parent node is unselected all children checkboxes should be unselected too.

       

      The main problem for me is to get access to the checkboxes of the children nodes. I can only get the TreenNodeImpl of the nodes but these don't contain the checkboxes.

      I tried to use an instance of UITree or HTMLTree to walk down the nodes to the children but same problem I can only get the TreeNodeImpl and no checkboxes.

       

      Hope someone understands my problem and has an idea.

      Here are parts of the source code:

       

      {code}<rich:tree id="mainTree" switchType="client" toggleOnClick="false" nodeFace="#{item.type}" value="#{TreeController.treeView}"

                                       var="item" nodeSelectListener="#{TreeController.processSelection}" >

           <rich:treeNode iconLeaf="/images/form_General.png" id="node" icon="/images/form_General.png" type="PlainForm" >

                <h:panelGroup>

                     <h:selectBooleanCheckbox value="#{item.selected}" id="cb" onchange="this.form.submit( );"

                          valueChangeListener="#{TreeController.checkboxClick}" />

                     <h:outputText value="#{item.name}" id="formNodeText" styleClass="exportTreeNodeText" />

                </h:panelGroup>

           </rich:treeNode>

      </rich:tree>

      {code}