In a Flex application, I'm have an xml object that I'm binding to a tree control. I'm able to add a child node to the xml but when I try to add a child to the child node it doesn't appear on the tree control
tree = <node label="Root">
<node label="Category 1"/>
<node label="Category2"/>
<node label="Category3"/>
<node label="Category 4">
<node label="SubCategory4.1"/>
<node label="SubCategory4.2"/>
</node>
</node>;
var someNode:XMLNode = new XMLNode(9, 'Category5');
var aSubNode:XMLNode = new XMLNode(9, 'SubCategory5.1');
someNode.appendChild(aSubNode);
tree.appendChild(someNode);
So Category5 appears on the tree control but SubCategory5.1 does not. What am I missing?
From stackoverflow
-
If you are using flex, use AS3. XMLNode is AS2. In short, try this:
tree = <node label="Root"> <node label="Category 1"/> <node label="Category2"/> <node label="Category3"/> <node label="Category 4"> <node label="SubCategory4.1"/> <node label="SubCategory4.2"/> </node> </node>; var someNode:XML = <node label="Category5"/>; var aSubNode:XML = <node label="SubCategory5.1"/>; someNode.appendChild(aSubNode); tree.appendChild(someNode);
philcruz : That works! Thanks!
0 comments:
Post a Comment