PDA

View Full Version : who can help me?


5219999
12-21-2005, 08:47 PM
hello everybody:
I am loooking for a way to add a node (a child) under the node that is currently selected in the tree. I am currently able to add a node under the root node, but the problem is that I do not know how to get a pointer on the current node.
who can help me?
Thank you very much

bfagan
12-22-2005, 06:47 AM
Can you post the code that's giving you a problem?

Can't tell you what you're doing wrong unless you show us what you're doing...

5219999
12-22-2005, 03:36 PM
Originally posted by bfagan
Can you post the code that's giving you a problem?

Can't tell you what you're doing wrong unless you show us what you're doing...
In fact ,i always login this forum, i want find more information about my problem,but i am failed,i found that they have the same problem with me.so i need your help.thank you very much.
this is my code:
<canvas height="500" debug = "true">
<include href="lz/tree.lzx"/>
<dataset name="filesys" src="resources/dirtree.xml"/>

<simplelayout axis="x" spacing="20"/>

<view width="200" height="200" clip="true">
<tree name="fs_tree" open="true" datapath="filesys:/entry/@name"
autoscroll="true">
<tree datapath="*" text="$path{'@name'}" open="true"
isleaf="${this.datapath.xpathQuery('@type') == 'file'}"/>
</tree>
<scrollbar visible="${scrollable}"/>
</view>

<datapointer name="dptr" xpath="filesys:/entry" />

<button text="Add a dot dir">
<method event="onclick">

traverse(dptr);
</method>
<method name="traverse" args="top">
var ne = new LzDataElement('entry', {name: '.', type: 'dir'});
top.p.appendChild(ne)
</method>
</button>

<button text="delete a dot dir">
<method event="onclick">

dptr.p.removeChild(dptr.xpathQuery('*[@name = "."]'))
</method>

</button>



</canvas>
in this code ,you can add a node in the root ,but you can not add node in what your chioce.
this is dirtree.xml:
<entry name="/" type="dir" >
<entry type="dir" name="usr">
<entry type="dir" name="bin">
<entry type="file" name="awk"/>
<entry type="file" name="grep"/>
<entry type="file" name="perl"/>
<entry type="file" name="bash"/>
</entry>
</entry>
<entry type="dir" name="var">
<entry type="dir" name="tmp"/>
<entry type="dir" name="log"/>
</entry>
<entry type="dir" name="home">
<entry type="dir" name="root">
<entry type="file" name=".profile"/>
</entry>
</entry>
<entry type="dir" name="lib"/>
<entry type="dir" name="etc"/>
</entry>