0
votes

How can we prevent expansion of a node when we click on the label adjacent to that node in YUI treeview? Though I have tried something given in this post. YUI Treeview (override labelClick) But it did not work for me.

what I have done is as follows.

     tree.subscribe("labelClick", function(node) {
     //some code here which I want  to execute when user clicks on label.
     YAHOO.util.Event.preventDefault(node.event);
     return false /*In order to prevent the node from expanding.*/
     });

what happens is when I click on label the node gets expanded and the event listener code also gets executed.So I do not want the node to expand.Just want the event listner code to execute.Please help.

1

1 Answers

0
votes

labelClick was kept for backward compatibility but it was deprecated long before YUI2 itself was deprecated (around 2.7.0). Use clickEvent instead. If you return false in the listener for clickEvent toggling will not happen.