3 Replies Latest reply on Jul 5, 2007 11:46 PM by PureDirect

    tree control with xml last node!

    PureDirect
      The question is how to view the tree lastleaf as last nodename + nodevalue in an xmlobject?

      <node1>
      <node1a>10
      </node1a>
      </node1>
      <node2>
      <node2a>
      <node2b>20
      </node2b>
      </node2a>
      </node2>
      I want the tree structure like:
      Node1 (folder icon)
      Node1a = 10 (doc icon)
      Node2
      Node2a
      Node2b = 20 (doc icon)


      In Flex the tree views:
      Node1 (folder icon)
      Node1a (folder icon)
      10 (doc icon)
      Node2
      Node2a
      Node2b (folder icon)
      20 (doc icon)

      in my app I get a result from a webservice that returns some nodes that can have one or more values. Say Node1a can have 10, 34, 43, so in the tree leaf I it should view Node1a = 10, 34, 43.

      Any suggestions?
        • 1. Re: tree control with xml last node!
          schjlatah Level 1
          I'm not quite sure I am understanding your question. Are you trying to set the labelField to something variable, or are you trying to make a custom item renderer?
          • 2. Re: tree control with xml last node!
            ntsiii Level 3
            It is easy to change the displayed labels on the Tree nodes using labelFunction().

            But, the tree wants to show the same structure as the dataProvider xml. It is not simple to have it do otherwise, though you might look into creating a custom DataDescriptor.

            I would just process the xml to make it the format the tree needs.

            Tracy
            • 3. Re: tree control with xml last node!
              PureDirect Level 1
              The problem is when the value is between xml tags ( <node>value</node>) the node name gets folder icon and value gets doc. icon.
              With lot of last elements, one has to click every node to see the values.
              With labelFunction every leaf gets null value:
              If hasComplex return localname
              Else
              Return localname + children

              When I try to pars xml to new one, hasChildren returns true for las element, and if there is no value the node shows null.
              Then walking the xml recursively how do I insert the nodes in new xml with the same structure but tags like (<node data=”value” />)? (to XMLListCollection)

              Hope it’s clearer