actionscript 3 - Flex Tree with infinite parents and children -


I am working on a tree component and I have a problem in popularizing the data provider for this tree I

The data that comes back from my database is a simple array of values. Each value object has 2 properties ParentID for Object and ParentID parents is futile and ParenID's parent for ParenID is parentID.

Any help with this is greatly appreciated.

Essentially the tree should look like this:

  Parent 1 Child 1 Child 1 Child 2 Children 1 Children 2 Children 2 Hair 1 Child 2 This current code With which I am testing:  
  public function setDataProvider (data: array): zero {var tree: Array = new array (); (Var i: number = 0; i  

There is a cross section of my data:

  ObjectID ParentID 1 NULL 10 NULL 8 NULL 6 NULL 4 6 3 6 9 6 2 6 11 7 7 8 5 8  

So, what is your real problem?

It appears that you are not actually making any children in your data provider. Every object should have children, this is your code, it is a little modified, but your code should be run completely Version:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; S: Application xmlns: fx = "http://ns.adobe.com/mxml/2009" xmlns: s = "library: //ns.adobe.com/flex/spark" xmlns: mx = "library: // Ns.adobe.com/flex/mx "minWidth =" 955 "minHeight =" 600 "creationComplete =" application 1_curation complete handler (event) "& gt; & Lt; Fx: Announcements & gt; & Lt ;! - Place non-visible elements (for example, services, value objects) - & gt; & Lt; / Fx: Announcements & gt; & Lt; Fx: script & gt; & Lt ;! [CDATA [Import mx.collections.ArrayCollection; Import mx.events.FlexEvent; [Bindable] Public types of data: array = {[objectID: 1, parentID: null}, {objectID: 10, parentID: null}, {objectID: 8, parentID: zero}, {objectID: 6, parentID: null } {ObjectID: 5, parentID: 6}, {objectID: 4, parentID: 6}, {objectID: 9, parent id: 6}, {objectID: 2, parentID: 6}, {objectID: 11, parentID: 7 }, {ObjectID: 7, parentID: 8}, {objectID: 5, parentID: 8},]); [BinDable] Public Works Data Provider: Array; Protected function application1_creationCompleteHandler (Event: FlexEvent): Zero {// TODO auto generated method stub setDataProvider (data); } Public function setetifier (data: array): zero {var tree: Array = new Array (); For (var i: number = 0; i  & Lt; / S: Applications & gt;  

Comments