4 Replies Latest reply on May 13, 2008 5:20 PM by dimival

    Another Tree question

    dimival Level 1
      I am trying to change the style of the text next to a folder icon (the items that can be expanded). The color style of the Tree component changes the color of every text in the Tree but i need to change only the color of the items that can be expanded.

      Any idea how to achieve this?

        • 1. Re: Another Tree question
          ntsiii Level 3
          Don't give up on doing it with styles until you have to, but at some point you are going to have to go to a custom TreeItemRenderer. I have an exmple on www.cflex.net that is neither trivial not too complicated when you are ready.
          • 2. Re: Another Tree question
            dimival Level 1
            I tried with styles but there is only the "color" one, and that one changes the whole text in a Tree, i just need to change some particular nodes, the ones which can be expanded (the ones with the folder).

            I did a test to change a single one, i used the itemClick event which has an itemRenderer property and i applied the style to that itemRenderer and it worked, the thing is that it only works when i click on an item because the itemClick event has an itemRenderer property. I checked the reference on the Tree component and i don't find any way to iterate over the itemRenderers :(

            Could you send me the exact url of the example you mentioned? I got a bit lost at that site, thanks Tracy
            • 3. Re: Another Tree question
              ntsiii Level 3
              Ok, but first, you will NEVER iterate over itemRenderers. They are recycled, and only the visible ones even exist. Everything in a renderer must be data-driven. The critical parts in a full renderer are the set data() method, the commitProperties method and the updatedisplayList()

              Here is that link:

              • 4. Re: Another Tree question
                dimival Level 1
                Thanks Tracy!!!

                Good example on how to achieve it, very simple in fact, can't believe i didn't think about it :P