PDA

View Full Version : Drag and Drop Tree item


welchhu
09-09-2005, 01:35 AM
I want to drag and drop a selected item from lefttree to righttree and or from righttree to lefttree Now, and also delete the item from the "from" tree and add the item to the "to" tree. I tried many methods but no result.
This is my code.
<canvas width="450" height="400">
<include href="lz/tree.lzx" />

<dataset name="leftdata">
<food name="valuemeal">
<food name="fries" grandparent="true" />
<food name="drink">
<food name="cola" grandparent="true" />
</food>
<food name="burger">
<food name="patty" grandparent="true" />
<food name="tomato">
<food name="lettuce" grandparent="true" />
</food>
<food name="onions" grandparent="true" />
<food name="buns" grandparent="true" />
</food>
</food>
</dataset>

<dataset name="rightdata">
<hobbit name="Frodo">
<hobbit name="Drogo">
<hobbit name="Fosco" grandparent="true" />
<hobbit name="Bolger, Ruby" grandparent="true" />
</hobbit>
<hobbit name="Brandybuck, Primula">
<hobbit name="Brandybuck, Gorbadoc">
<hobbit name="Brandybuck, Coffee"
grandparent="true" />
</hobbit>
<hobbit name="Took, Mirabella" grandparent="true" />
</hobbit>
</hobbit>
</dataset>

<view x="20" y="20" layout="axis: x; spacing: 10">
<view width="200" height="200">
<tree datapath="leftdata:/" showroot="false">
<tree id="left" open="true" multiselect="true"
datapath="*" text="$path{'@name'}" isleaf="$path{'@grandparent'}" />
</tree>
</view>

<view width="200" height="200">
<tree datapath="rightdata:/" showroot="false">
<tree id="right" multiselect="true" datapath="*"
icon="null" text="$path{'@name'}" isleaf="$path{'@grandparent'}" />
</tree>
</view>

<method name="insertnode" args="first, second"></method>

<method name="removenode" args="first, second"></method>
</view>
</canvas>
I hope someone give me an answer!