3 Replies Latest reply on Jan 5, 2011 7:00 PM by mariusz bogucki

    <rich:tree> with checkbox

    sk rajath Newbie

      Hi i am implementing RichFaces checkbox tree. I  need to mark all the child nodes when user selects root  node. Any way of doing it?

        • 1. Re: <rich:tree> with checkbox
          Ilya Shaikovsky Master

          just add a4j:support to the checkbox and in its action get all children of current object and set checked as true. then rerender tree.

          • 2. Re: <rich:tree> with checkbox
            sk rajath Newbie

            Here in this tree child nodes of a parent node are got when clicked on parent node. Now i have just done like this

             

            <rich:tree                 rightClickSelection="true"
                                            nodeSelectListener="#{test.processNodeSelection}"
                                            ajaxSubmitSelection="true" switchType="client"
                                            value="#{test.root}" var="item"
                                            icon="/atsapp/images/favorite#{item.node.loaded}.png"
                                            iconLeaf="/atsapp/images/favorite#{item.node.loaded}.png"
                                            oncontextmenu="true" reRender="tree">

                                          <rich:treeNode id="treeNode">                          

             

                                                <h:outputText
                                                    value="#{item}" />


                                                <h:selectBooleanCheckbox id="selectAll"   >
                                                   
                                                    <a4j:support event="onclick" reRender="tree"  />
                                                </h:selectBooleanCheckbox>

                                            </rich:treeNode>

            </rich:tree>

             

            So checkboxes are coming for all nodes and all child nodes when they are invoked.

            But when i check on root node checkbox, how to know which node i checked ? and how to check all children under it.?

            • 3. Re: <rich:tree> with checkbox
              mariusz bogucki Newbie

              <a4j:support event="onclick" reRender="tree"  />  should have some action method if you want to use it for this purpose and check all coresponding nodes(to the node that was chcecked)  in that method. than rerender entire tree like it was said above.