The API is listed here: http://livedocs.macromedia.com/labs/1/flex20beta2/langref/mx/controls/treeClasses/ITreeDataDescriptor.html

 

The most important ones are isBranch and getChildren.  In B2 be aware that isBranch and getChildren can be passed null in which case you should just return false and null respectively.  If you don’t need drag and drop just have addChildAt and removeChildAt return false.  getChildren should just return an ArrayCollectoin that contains the array pointed to by the node property.  isBranch would return true if node != null && node.length > 0 I guess.

 

HTH,

Matt


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Jonas Windey
Sent: Wednesday, April 26, 2006 12:49 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Objects and arrays as treeview datasource

 

Any examples on how to do that? The help only mentions some addChildAt methods, but I don’t think I have to loop through all the data?

 

Jonas

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matt Chotin
Sent: woensdag 26 april 2006 8:42
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Objects and arrays as treeview datasource

 

Since the children are named “node” and not “children” the default data descriptor isn’t going to work.  You probably need to write a quick ITreeDataDescriptor implementation that will return the right children property/collection.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Jonas Windey
Sent: Tuesday, April 25, 2006 1:30 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Objects and arrays as treeview datasource

 

Hi,

 

I’m trying to fill my treeview with data retrieved from a webservice. I have my resultformat set to default (Object), as e4x or xml doesn’t give the correct result.

 

Filling a datagrid with the data I retrieve works perfectly, but the problem is when there are nested objects in it, the tree doesn’t draw childNodes.

 

This is the value of my webservice result object:

 

event = events.DataManagerResultEvent (@2b67be6)

       bubbles = false : Boolean

       cancelable = false : Boolean

       currentTarget = managers.DataManager (@2b0b0b6)

       eventPhase = 2 [0x2] : Number

       result = mx.utils.ObjectProxy (@29d6e46)

              getCategoriesResult = Object (@2bab0a6)

                     node = Object (@2bab8c6)

                           node = Array (@2b672b6)

                                  [0] = Object (@2baba66)

                                         catID = 15 [0xf] : Number

                                         label = "Pixco Labs" : String

                                  [1] = Object (@2babc26)

                                         catID = 1 [0x1] : Number

                                         label = "Technology" : String

                                         node = Array (@2b671c6)

                                                [0] = Object (@2babe06)

                                                       catID = 6 [0x6] : Number

                                                       label = "ASP.NET" : String

                                                [1] = Object (@2b9c046)

                                                       catID = 7 [0x7] : Number

                                                       label = "HTML/CSS" : String

                                                [2] = Object (@2b9c246)

                                                       catID = 8 [0x8] : Number

                                                       label = "_javascript_" : String

                                                [3] = Object (@2b9c426)

                                                       catID = 9 [0x9] : Number

                                                       label = "SQL" : String

                                                [4] = Object (@2b9c606)

                                                       catID = 10 [0xa] : Number

                                                       label = "Tech Experiments" : String

                                                [5] = Object (@2b9c7e6)

                                                       catID = 16 [0x10] : Number

                                                       label = "Flash/Flex/Flash Lite" : String

                                                length = 6 [0x6] : Number

                                  [2] = Object (@2b6fa06)

                                         catID = 2 [0x2] : Number

                                         label = "Utilities" : String

                                         node = Array (@2b67376)

                                                [0] = Object (@2babf66)

                                                       catID = 11 [0xb] : Number

                                                       label = "Client tools" : String

                                                [1] = Object (@2babd66)

                                                       catID = 12 [0xc] : Number

                                                       label = "Server tools" : String

                                                length = 2 [0x2] : Number

                                  [3] = Object (@2babb86)

                                         catID = 3 [0x3] : Number

                                         label = "Design" : String

                                         node = Array (@2b676d6)

                                                [0] = Object (@2bab966)

                                                       catID = 13 [0xd] : Number

                                                       label = "Cool layouts" : String

                                                [1] = Object (@2bab386)

                                                       catID = 14 [0xe] : Number

                                                       label = "Design experiments" : String

                                                length = 2 [0x2] : Number

                                  [4] = Object (@2c62e26)

                                         catID = 4 [0x4] : Number

                                         label = "Usability" : String

                                  [5] = Object (@2c62286)

                                         catID = 5 [0x5] : Number

                                         label = "Off-topic" : String

                                  length = 6 [0x6] : Number

                            xmlns = 0 [0x0] : Number

              object = Object (@2bab1a6)

              uid = "F97D8CAC-0C05-4ED5-3B1FFFFFFFFF090A" : String

              xmlns = "http://tempuri.org/" : String

       target = managers.DataManager (@2b0b0b6)

       type = "getCategoriesResponse" : String

 

 

The tree only renders the nodes in the root, it doesn’t create the subNodes.

Do I need to loop through this data in code? It would be a lot easier if I could just put this result as the dataSource for my tree.

 

Thanks for any suggestions,
Jonas






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to