maroch
07-26-2007, 06:51 AM
hello i have a problem witch my tree in Laszlo, I'm beginner, ok this is my tree
<tree name="fs_tree" id="t11" datapath="dset:/Element/@name" icon="null"
showhandcursor="true" >
<method event="onfocus">
some = this.datapath.xpathQuery('@name');
</method>
<tree datapath="*" expander="lztree_plusminus_rsc" text="$path{'@name'}" id="t12" autoscroll="true" >
<method event="onfocus">
some = this.datapath.xpathQuery('@name');
</method>
</tree>
</tree>
I want to add some child to the selected item like that (dptr - is a datapointer to dataset)
<button text="Save" width="100" height="20" x="190" y="30">
<handler name="onclick">
traverse(dptr);
</handler>
<method name="traverse" args="top">
var ne = new LzDataElement('entry', {name: 'nowy', type: 'dir'})
do{
var root = top.dupePointer();
if (root.selectChild()) {
traverse(root)
if(top.xpathQuery('@name')== some)
top.p.insertBefore(ne, top.p.getFirstChild())
}
else{
if(top.xpathQuery('@name')== some){
Debug.write(top.xpathQuery('@name') + ' 1 ' + some + top.p.getFirstChild())
top.p.appendChild(ne);
Debug.write(top.xpathQuery('@name') + ' 2 ' + some + top.p.getFirstChild())
}
}
}while(top.selectNext())
</method>
</button>
its working but when i add children to parent who hasn't any child i cant see him, i must add some child to the first tree, therefor i can see him
HELP!!!!
<tree name="fs_tree" id="t11" datapath="dset:/Element/@name" icon="null"
showhandcursor="true" >
<method event="onfocus">
some = this.datapath.xpathQuery('@name');
</method>
<tree datapath="*" expander="lztree_plusminus_rsc" text="$path{'@name'}" id="t12" autoscroll="true" >
<method event="onfocus">
some = this.datapath.xpathQuery('@name');
</method>
</tree>
</tree>
I want to add some child to the selected item like that (dptr - is a datapointer to dataset)
<button text="Save" width="100" height="20" x="190" y="30">
<handler name="onclick">
traverse(dptr);
</handler>
<method name="traverse" args="top">
var ne = new LzDataElement('entry', {name: 'nowy', type: 'dir'})
do{
var root = top.dupePointer();
if (root.selectChild()) {
traverse(root)
if(top.xpathQuery('@name')== some)
top.p.insertBefore(ne, top.p.getFirstChild())
}
else{
if(top.xpathQuery('@name')== some){
Debug.write(top.xpathQuery('@name') + ' 1 ' + some + top.p.getFirstChild())
top.p.appendChild(ne);
Debug.write(top.xpathQuery('@name') + ' 2 ' + some + top.p.getFirstChild())
}
}
}while(top.selectNext())
</method>
</button>
its working but when i add children to parent who hasn't any child i cant see him, i must add some child to the first tree, therefor i can see him
HELP!!!!