I think the "label" property need to be at the top level of the treeNode. So your example: var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode.label, treeNode ); Should work.
Remember when accessing the treeNode, use the TreeDataProvider API, like getProperty("label"), and getData() Tracy -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pat_ryan_99 Sent: Monday, August 15, 2005 12:02 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Tree component help - please Thank you for the response, but that produced the same results. Other thoughts? I assume that since my TreeNodeVO has a label attribute, that is all that is really required? Is it having trouble understanding this VO? Thanks again Pat --- In flexcoders@yahoogroups.com, "Andrew Spaulding" <[EMAIL PROTECTED]> wrote: > Hi, > > Maybe try something like this: > > <mx:Tree nodeOpen="getNodes(event.node)" /> > > you might want to store a reference to this node rather than using > contentMgmtTree.selectedItem. > > So you script block might look like this: > > public function getNodes( treeNode ) > { > treeSelectedNode = treeNode; > EventBroadcaster.getInstance().broadcastEvent( "getTheNodez", > treeNode.getData().oid ); > } > > > //and for adding the nodes > > public function addTreeNodeUnderSelected(treeNode:TreeNodeVO) > { > var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode ); > //or break it down even further with this > //var tempNode:TreeNode = treeSelectedNode.addTreeNode( > treeNode.label, treeNode ); > > if( treeNode.hasChildren == true ) > { > tempNode.setProperty( 'isBranch', true, true ); > } > else > { > tempNode.setProperty( 'isBranch', false, true ); > } > } > > > The only real difference is that I store a reference to the selected > node from the nodeOpen event using event.node. This is then what I > would use to add the child nodes to. > > See how that goes. > > Andrew Spaulding > www.flexdaddy.info > > > > > --- In flexcoders@yahoogroups.com, "pat_ryan_99" <[EMAIL PROTECTED]> wrote: > > Hi Everyone, > > > > I have looked through old messages in this group and did not see > > anything that addresses my question - or at least it was not clear > > that it did. > > > > Here is what I am trying to do. > > > > Using the Cairngorm framework, I am making a remote call to my server > > to retrieve something I wrote called a TreeNodeVO ( which has a public > > label property ). > > > > My ViewHelper adds the Root node like this (which works ): > > > > public function addRootTreeNode(treeNode:TreeNodeVO) : Void { > > view.contentMgmtTree.removeAll(); > > var node:Object = view.contentMgmtTree.addTreeNode(treeNode); > > if( treeNode.hasChildren == true ) { > > view.contentMgmtTree.setIsBranch(node,true); > > } > > } > > > > when I open the tree node, I make another remote call to get the > > children as an Array of TreeNodeVO objects. > > > > The ViewHelper method to add the other nodes under the opened node > > looks like: > > > > public function addTreeNodeUnderSelected(treeNode:TreeNodeVO) : Void { > > trace("treeNode: " + treeNode.toString()); > > var node:Object = > > view.contentMgmtTree.selectedItem.addTreeNode(treeNode); > > if( treeNode.hasChildren == true ) { > > view.contentMgmtTree.setIsBranch(node,true); > > } > > } > > > > what I see happening is the root node renders correctly as a folder > > with the right label. When I open the folder the server is returning > > the correct array of TreeNodeVO objects but what is rendered under the > > root node is a document icon ( which is correct ) but with the label > > "[type Function],[type Function],..." > > > > Can someone please point me in the right direction on the correct way > > to add nodes that DO NOT use the XML model? > > > > Any help is greatly appreciated. > > > > > > Thanks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hohv8e7/M=362335.6886445.7839731.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124133933/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!</a>.</font> --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/