Tanmay
09-20-2009, 10:24 PM
I am a little confused about the tree view control as I have never used it earlier, so I have a question which is simple for all geeks out here :). Below is the sample xml which I am trying to make a tree of-
<table tname="alphabet">
<row val="abc" type="menu1" parent=""/>
<row val="def" type="screen1" parent="menu1"/>
<row val="ghi" type="screen2" parent="menu2"/>
<row val="jkl" type="screen3" parent="menu1"/>
<row val="mno" type="menu2" parent=""/>
<row val="pqr" type="menu3" parent=""/>
</table>
As you can notice the relation is defined in attribute "parent", so if "def" has a parent="menu1" then it sud come under that node. Here is my try with it -
<dataset name="ds" src="tree.xml"/>
<tree visible="true" name="tv" width="160" height="200" datapath="ds/table/"
text="$path{'@val'}" multiselect="false" closesiblings="false">
<tree width="160" height="20" datapath="*" text="$path{'@val'}"
isleaf="${this.datapath.xpathQuery('@parent') != ''}" ></tree>
</tree>
The issue with the above code is it is not showing the hierarchy correctly and all elements appear in same level. So guys please help me out in how to use the "parent" atribute to get the relation going and tree showing it correctly...
<table tname="alphabet">
<row val="abc" type="menu1" parent=""/>
<row val="def" type="screen1" parent="menu1"/>
<row val="ghi" type="screen2" parent="menu2"/>
<row val="jkl" type="screen3" parent="menu1"/>
<row val="mno" type="menu2" parent=""/>
<row val="pqr" type="menu3" parent=""/>
</table>
As you can notice the relation is defined in attribute "parent", so if "def" has a parent="menu1" then it sud come under that node. Here is my try with it -
<dataset name="ds" src="tree.xml"/>
<tree visible="true" name="tv" width="160" height="200" datapath="ds/table/"
text="$path{'@val'}" multiselect="false" closesiblings="false">
<tree width="160" height="20" datapath="*" text="$path{'@val'}"
isleaf="${this.datapath.xpathQuery('@parent') != ''}" ></tree>
</tree>
The issue with the above code is it is not showing the hierarchy correctly and all elements appear in same level. So guys please help me out in how to use the "parent" atribute to get the relation going and tree showing it correctly...