I have a tree I'm populating with objects that mimic my serverside
Group classes. What's happening is that the tree is getting built, but
the data field of the nodes isn't getting filled.

This method:
var node = treeDP.addTreeNode(group.name, group);

is supposed to create a node with the label of the group's name, and
the group object itself as the data. Problem is, while the tree gets
populated, and you can see the nodes with labels, the actual group
isn't there in the data field. Obviously the group is getting
instantiated, because the tree nodes have labels... Any reason why
this shouldn't work?

I'm new to Flex, and AS, but this seems like it should work.

Below is the code I use to fill my tree...

var treeDP;     
public function initGroupTree() {
        user = mx.core.Application.application.user;
        var topGroups:Array = user.organization.onlyTopSuperGroups;
        treeDP = new TreeNode();
        for(var i in topGroups) {
                var group:Group = topGroups[i];
                var node = treeDP.addTreeNode(group.name, group);
                addSubGroupsToTree(node, group);
        }
        groupTree.dataProvider = treeDP; 
}

private function addSubGroupsToTree(node, group:Group):Void {
        var subGroups:Array = group.subGroups;
        for(var i in subGroups) {
                var group:Group = subGroups[i];
                var subNode = node.addTreeNode(group.name, group);
                addSubGroupsToTree(subNode, group);
        }
}





 
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/
 



Reply via email to