1 Reply Latest reply on Jun 6, 2008 9:20 AM by dimival

    Building Tree with data from Java Arraylist

    guilhermea
      I'm trying to build a Tree (Flex component). I'm using Java to return an arraylist, which i turn to type Arraycollection in the .mxml file, and configure the dataprovider with that ArrayCollection data. My problem is that i don't know how the structure of the array should be, or how to indicate the branches and leafs. I can see the data i pass in the array displayed in the tree, but all defined as leafs, at the same level. There are lots of examples with XML dataproviders and even with array defined in the .mxml file(mx:array), but my problem is different and can't find a way of getting this to work. Can anyone help me?
      Thanks,
      Guilherme
        • 1. Re: Building Tree with data from Java Arraylist
          dimival Level 1
          I have an app that reads an XML and then creates an Array for populating a Tree. Each element of the array is a generic object that can have or not an array as well with the children of that element. Then i only pass this array to the tree and works.

          You need an array of arrays or in your case a list of lists, so your Java method should return an arraylist whose elements have or not an arraylist too, and so on.

          Hope this helps