6 Replies Latest reply on Jun 13, 2007 1:44 PM by ntsiii

    Need help with Tree component

    Yann Martel
      Hello everybody.

      I have a tree component with an XML dataprovider. It represents folders (branch) and files (leaves). I'd like it to display only the branches and not the leaves. The problem is that I want the files information to stay in the XML component.

      I tried messing around with a custom TreeItemRenderer but didn't have much success.
      I also couldn't file a css property like visible="hidden" or something like that.

      Anyone knows how I should do it ?
        • 1. Re: Need help with Tree component
          foxglove1028
          I know that it would be a pain in going back to the xml document but you might want to put on the file nodes to have the property 'visible = "false"'

          Or set the ones that will be the folder to have the property 'isBranch=true' and any of the nodes that don't have that prpperty to have the property visible = 'false'.

          But you definately want to look for the isBranch property cause if the isBranch property is set to false then that is what makes the leaves in the Tree Component.
          • 2. Need help with Tree component
            Yann Martel Level 1
            Thanks !
            I didn't know about the "visible" property (I don't know much about XML). Knew about isBranch though :)

            *-edit-*

            In fact, I've just tried and the nodes still display even when I put the property visible="false". I couldn't find this property in the documentation. Can you tell me where I can find more information about it ?
            • 3. Re: Need help with Tree component
              goingflex Level 1
              Hi
              I am trying to display folders and files also. Can not get my tree to work.
              If you have anything cool I would appreciate to see the way you achieved this.

              Regards.
              • 4. Re: Need help with Tree component
                cws14
                Hi,

                I am also having the same problem/wanting to do the same thing. I have a custom treeItemRenderer and I want to use it to be able to *not* render the leaf nodes in the tree. I have a way that I can tell if the item being rendered is a leaf or not - but I cannot for the life of me figure out how to not have that item render.

                I have tried setting the data property to null - which kind of works in that the label and icon do not show up in the Tree, but the renderer still leaves a large white blank spot in the tree. Then I tried to set the rowheight to zero (I set the variableRowHeight property to true first), but that doesn't seem to make a difference either.

                If anyone has any insight into this problem, I would really appreciate it. Even if the insight is, "that's not possible".

                Thanks,
                Chloe
                • 5. Re: Need help with Tree component
                  Richard_Gavel
                  The problem you're having is that the by the point you get to the renderer, the tree has already decided what items within the data model it wants to renderer. The ideal solution is to develop a custom class that implements ITreeDataDescriptor. You could probably extend DefaultDataDescriptor and override the isBranch function. The object mentioned should be of type XML and based upon the contents of the XML node, you'd return true/false appropriately.
                  • 6. Re: Need help with Tree component
                    ntsiii Level 3
                    I myself am on the lookout for a very simple example that shows a custom class that implements ITreeDataDescriptor.

                    Reading the docs makes it seem difficult, but the same is true of the itemRenderer docs, and simple itemRenderers are pretty easy.

                    I'll post if I find such an example.

                    Tracy