PDA

View Full Version : tree and tree


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!!!!

maroch
07-26-2007, 11:29 PM
How can I update the tree after adding a node to parent without children to the dataset?

maroch
07-27-2007, 05:02 AM
so when i use appendChild function then tree is no refresh, but when i use insertbefore everything is ok! where is the problem ? ondata ?

maroch
07-31-2007, 05:31 AM
how can i see added child in a tree ????