The TreeView generates its own ids on each of the nodes so the ids of
the original markup is lost. The attribute 'class' is converted to
'className' so you can use:
alert(tree.getNodeByProperty('className','mylabel1').label);
Satyam
mario25960 escribió:
> hello
>
> a newbie question, but I am unable to find the answer looking at the API.
> In treeview, when I render the tree, how can I get labels from the markup
(e.g. in the example below, myid1 for that tree node).
>
> A quick tutorial would be very welcome.
> Thanks best wishes
> mario
>
>
> =======================
> ......
> <script type="text/javascript">
>
> var tree;
> function treeInit() {
> tree = new YAHOO.widget.TreeView("treeDiv1");
> var root = tree.getRoot();
> tree.subscribe("expand", function(node) {
> alert("node.label: "+ node.label);
> alert("node.getLabelEl().innerHTML : " + node.getLabelEl().innerHTML);
> });
> tree.render();
> }
> YAHOO.util.Event.onDOMReady(treeInit);
> </script>
> </head>
> <body class="yui-skin-sam">
> <div id="treeDiv1">
> <ul class>
> <li >List 0
> <li class="mylabel1" id="myid1" >List 0-0
> <ul>
> <li>item 0-0-0</li>
> <li>item 0-0-1 </li>
> </ul>
> </li>
> </li>
> </ul>
> </div>
> </body>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.4/2218 - Release Date: 07/04/09
17:55:00
>
>