Can not add a new node into the Tree!!!


my codes:
<mx:application xmlns:mx=" http://www.adobe.com/2006/mxml">

<mx:script>
<![cdata[

public function addaction():void
{
var xml:xml = <node label="new test"/>;
treedata.insertchildafter(mytree.selecteditem, xml);
}
]]>
</mx:script>

<mx:xmllist id="treedata">
<node label="mail box">
<node label="inbox">
<node label="marketing"/>
<node label="product management"/>
<node label="personal"/>
</node>
<node label="outbox">
<node label="professional"/>
<node label="personal"/>
</node>
<node label="spam"/>
<node label="sent"/>
</node>
</mx:xmllist>

<mx:panel title="tree control example" height="75%" width="75%"
paddingtop="10" paddingleft="10" paddingright="10" paddingbottom="10">
<mx:button label="add new node" click="addaction();"/>
<mx:tree id="mytree" width="50%" height="100%" labelfield="@label"
showroot="false" dataprovider="{treedata}"/>

</mx:panel>
</mx:application>

only "mail box" can added new node, , not in others, why?

the insertchildafter() call working correctly me when run code if select 1 of mailbox's children. can't insert when select mailbox node because root node , can have 1 root node e4x xml.


More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Authentication error while password reset - Raspberry Pi Forums

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums