9 Replies Latest reply on Jun 12, 2009 3:52 PM by meghiddo

    if I am using recursiveTreeNodeAdaptor how do I have clickin

      <rich:tree>
      <rich:recursiveTreeNodesAdaptor roots="#{treeBean.projectNameList}" var="item" nodes="#{treeNodesBean.ids}" />
      </rich:tree>

      That is the simple tree I have working right now. Definitely not what I need in the end, but the best i can do until I get some help.

      But looking at the recursiveTreeNodeAdaptor tag there doesnt seem to be any attributes I can use to control what happens when someone clicks on a node. I was expecting "onclick" or at least "nodeSelectListener" but it has none of those attributes.

      So is there something I am missing? Is it possible to have clicking on a node do anything if I am using recursiveTreeNodeAdaptor?

        • 1. Re: if I am using recursiveTreeNodeAdaptor how do I have cli

          Oh and also the code I have above does something odd. It uses projectNameList as the roots which is fine. And if you expand one of the roots it has all of the values from ids under it. So far so good.
          But then each of these nodes is expandable and also contains every value from ids. ANd then all those nodes are expandable and contain the ids values, and so on and so on.
          In other words it is a never ending, ever expanding tree!
          Is there a way I can tell it to stop after the first set of nodes are added?

          Though I get the feeling this is how this is supposed to work, I am just using it incorrectly when I bind a list to nodes. I know I am supposed to use var="item" and then for nodes use item.name, etc.

          But I cant make that work. If you want to try and help with that problem lok at the other thread I recently posted on this board

          • 2. Re: if I am using recursiveTreeNodeAdaptor how do I have cli
            nbelaevski

             

            "Meghiddo" wrote:
            But looking at the recursiveTreeNodeAdaptor tag there doesnt seem to be any attributes I can use to control what happens when someone clicks on a node. I was expecting "onclick" or at least "nodeSelectListener" but it has none of those attributes.

            Add rich:treeNode and define the attributes there.

            • 3. Re: if I am using recursiveTreeNodeAdaptor how do I have cli

              But will rich:treeNode work if it is a list I am using to populate the tree? It seems like I tried that and only go a blank page. plus I need to be able to have control over what clicking on the roots as well as the nodes will do.

              • 4. Re: if I am using recursiveTreeNodeAdaptor how do I have cli
                nbelaevski

                Yes, it should work. Check examples at livedemo.

                • 5. Re: if I am using recursiveTreeNodeAdaptor how do I have cli

                  Bleh I have the livedemo stuff memorized by now lol.
                  Ill look at it all again though, Im sure I just am missing something

                  • 6. Re: if I am using recursiveTreeNodeAdaptor how do I have con

                    wow, it took me so many diffferent attempts to do this...another day spent on this tree, and it still isnt even close to where I need it to be ><

                    here is what finally worked when I was about to give up:

                    <rich:tree nodes="#{treeBean.projectNameList}" >
                    <rich:recursiveTreeNodesAdaptor roots="#{treeBean.projectNameList}" var="item" />
                    <rich:treeNode value="#{item}" />
                    </rich:tree>

                    and now honestly I dont even rememebr why i was doing this in the first place ><

                    The livedemo stuff really doesnt show this tbh, I tried to follow every version of the livedemo examples but nothing worked, it was all just blank space.

                    • 8. Re: if I am using recursiveTreeNodeAdaptor how do I have cli
                      nicoliniyo

                      I'll show you what worked for me:

                      <a4j:outputPanel>
                      <rich:tree style="width:300px"
                       id="arbol"
                       dropListener="#{regionGrupoArbol.processDrop}"
                       switchType="ajax"
                       rendered="true"
                       >
                      
                       <rich:recursiveTreeNodesAdaptor id="ramas"
                       roots="#{regionAdministrador.regionGrupoArbol}" //this is a list, start of the iteration
                       var="item"
                       nodes="#{item.nodes}" //this is a recursive call that returns a list of items, Regions in this case
                       rendered="true"
                       >
                       <rich:treeNode>
                       <h:outputText value="[#{item.nombreNodo}] #{items.regiones == null}" />
                      
                       </rich:treeNode>
                      
                       </rich:recursiveTreeNodesAdaptor>
                      
                       </rich:tree>
                      </a4j:outputPanel>
                      

                      Enclosed in an <a4j:outputPanel> as you can see!

                      And I've added a Ovverride to my entity:
                       @Override
                       public String toString() {
                       return this.getNombreNodo();
                       }
                      


                      • 9. Re: if I am using recursiveTreeNodeAdaptor how do I have cli

                        Maybe youll be able to help me with something else then too.
                        I am having trouble with the iteration.
                        I have a list that I have loaded with the names of all my projects, and another list I have loaded with the names of all devices.
                        So as of right now Im using projects list as the roots and devices list as the nodes.
                        So all this does is uses every project for the roots, and under every project is listed every device.
                        However, only certain devices belong to a project, they should not all go under every project.

                        But I don't know how to handle this. People have been telling me I will need to use lists of lists, or maybe TreeNode. But I can't figure it out, I don't have enough experience dealing with this.

                        So using your code as an example, you have a list regionAdministrador.regionGrupoArbol. Then you use var=items. I get that, but then for the nodes you use item.nodes. How does this work?
                        I guess I should first ask, what is included in your list regionAdministrador.regionGrupoArbol?

                        All I know how to do is load a list with different values. Do you have that list loaded with xml? I have a web service that has xml, tha has projects, and under each project some devices. I need to use the project names as the roots, and only the devices that appear under the project for that projects nodes.

                        I know this isnt the best explanation of my issue, Im just tired from trying to get this to work for the last few days.

                        I guess if you could just tell me what your regionAdministrador.regionGrupoArbol list holds it would help. ANd then when you iterate through it using item.nodes, what is that doing? Do you have something called "nodes" in that list? Or is the rich tree tag recognizing nodes to mean something else?