Loading ...
Sorry, an error occurred while loading the content.

Upgrade 2.6 to 2.7 treeview TextNode.href="javascript:fcn()" no longer works?

Expand Messages
  • dufferdo25
    Hello all, I upgraded to 2.7.0 and have been successful with everything except the left mouse click on the TextNode. It no longer works. Do I need to use the
    Message 1 of 2 , Apr 29, 2009
    • 0 Attachment
      Hello all,
      I upgraded to 2.7.0 and have been successful with everything except the left mouse click on the TextNode. It no longer works.
      Do I need to use the labelClick listener and if so, how do I assign each individual value(somevalue) to the js function I am calling?

      BROKEN CODE:
      var txtNodeAtts = {id:aArrayEl[0], label:aArrayEl[1]};
      var txtNode = new YAHOO.widget.TextNode(txtNodeAtts, theRoot, bExpanded);
      txtNode.href = "javascript:jsFunction(somevalue)";//This no longer works.

      Thanks.
    • Satyam
      It doesn t and it shouldn t. Placing code into href attributes is not recommended. Instead you should listen to clickEvent (not labelClick, which is
      Message 2 of 2 , Apr 29, 2009
      • 0 Attachment
        It doesn't and it shouldn't. Placing code into href attributes is not
        recommended. Instead you should listen to clickEvent (not labelClick,
        which is deprecated). You set a single listener on the whole tree
        instead of in each particular node. The listener will receive a single
        argument, an object with two properties, node and event. Argument node
        will be a reference to the node that was clicked. Since you can add
        custom data to each node, you can pick any arguments you might need,
        such as 'somevalue', from the node itself and do whatever you want.
        Clicking on a node will usually toggle it and set the focus on the
        node. If you listen to clickEvent you might want to do something else.
        To prevent the default action, return false at the end of the listener.

        Satyam


        dufferdo25 escribió:
        > Hello all,
        > I upgraded to 2.7.0 and have been successful with everything except the left mouse click on the TextNode. It no longer works.
        > Do I need to use the labelClick listener and if so, how do I assign each individual value(somevalue) to the js function I am calling?
        >
        > BROKEN CODE:
        > var txtNodeAtts = {id:aArrayEl[0], label:aArrayEl[1]};
        > var txtNode = new YAHOO.widget.TextNode(txtNodeAtts, theRoot, bExpanded);
        > txtNode.href = "javascript:jsFunction(somevalue)";//This no longer works.
        >
        > Thanks.
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - www.avg.com
        > Version: 8.5.287 / Virus Database: 270.12.8/2086 - Release Date: 04/29/09 06:37:00
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.