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

Re: Omitting tree expand when code label clicked in TreeView

Expand Messages
  • Chun
    When you create the data object of the node, set the href as javascript:void(0); . The following is an example: var oData = {label: My Label , id: my_id ,
    Message 1 of 7 , Feb 2, 2007
    • 0 Attachment
      When you create the data object of the node, set the href as
      'javascript:void(0);'. The following is an example:

      var oData = {label: 'My Label', id: 'my_id', href: 'javascript:void(0);'};
      var node = new YAHOO.widget.TextNode(oData, parentNode, false);

      Hope this helps.

      Chun Pan (Billy)
      Sr. Applications Developer
      NetCentrics Corporation


      --- In ydn-javascript@yahoogroups.com, "suchanek_tomasz"
      <suchanek_tomasz@...> wrote:
      >
      > As written in topic. How can I omit expanding tree when labal is
      > clicked? I want to expand/collapse nodes only when icon + - is clicked.
      >
    • Alessandro Vernet
      Eric, I am following up on this thread from February. The solution you suggest works, but the downside is that it requires to re-implement the method
      Message 2 of 7 , Apr 19, 2007
      • 0 Attachment
        Eric,

        I am following up on this thread from February. The solution you suggest
        works, but the downside is that it requires to re-implement the method
        getNodeHtml(). This means doing a large copy-paste of TextNode.getNodeHtml()
        and just removing the line that sets the href. Since the code generated
        there is tied to some internal code of the tree, there is a chance that this
        method will need to be modified when upgrading to a new version of YUI.

        So I would really prefer to have a way to tell the existing TextNode not to
        generate an href.

        For some background, this happens when you do a tree.subscribe("labelClick",
        ...) to handle clicks on labels. You don't want to go to a URL, and you
        don't want the default behavior (collapse/uncollapse).

        Alex


        Eric Miraglia wrote:
        >
        > suchanek_tomasz,
        >
        > The best solution for you here is to use HTMLNodes rather than the
        > TextNodes. See the TreeView documentation for more on how to use
        > HTMLNodes.
        >
        > Regards,
        > Eric
        >
        > ______________________________________________
        > Eric Miraglia
        > Yahoo! User Interface Library
        >
        >
        >
        > On Feb 1, 2007, at 7:52 AM, suchanek_tomasz wrote:
        >
        >> As written in topic. How can I omit expanding tree when labal is
        >> clicked? I want to expand/collapse nodes only when icon + - is
        >> clicked.
        >>
        >>
        >>
        >
        >
        >

        --
        View this message in context: http://www.nabble.com/Omitting-tree-expand-when-code-label-clicked-in-TreeView-tf3155643.html#a10085209
        Sent from the ydn-javascript mailing list archive at Nabble.com.
      • Eric Miraglia
        Alessandro, Two quick thoughts here: 1. Working with TreeView on its current terms, you could get very close to what you want (maybe all the way there) by
        Message 3 of 7 , Apr 19, 2007
        • 0 Attachment
          Alessandro,

          Two quick thoughts here:

          1.  Working with TreeView on its current terms, you could get very close to what you want (maybe all the way there) by returning false on your labelclick handler and the using css to style away the linkiness of the <a> tag.  Adam Moore, TreeView's author, notes that this relies on the DOM0 behavior wrt returning false, and we haven't tested this across the A-grade browsers.  But I ran it through several just now with good results.  Caveat emptor, of course, but it may be something to try.

          2.  What you are really asking for, I think, is more control over how TextNodes are created/structured (and in your  subsequent email you're asking for the API for labelclick be inclusive of TaskNode).  The best way to get these requests into our process is to add them as feature requests in SourceForge.

          Regards,
          Eric

          ______________________________________________
          Eric Miraglia
          Yahoo! User Interface Library



          On Apr 19, 2007, at 12:25 PM, Alessandro Vernet wrote:


          Eric,

          I am following up on this thread from February. The solution you suggest
          works, but the downside is that it requires to re-implement the method
          getNodeHtml(). This means doing a large copy-paste of TextNode.getNodeHtml()
          and just removing the line that sets the href. Since the code generated
          there is tied to some internal code of the tree, there is a chance that this
          method will need to be modified when upgrading to a new version of YUI.

          So I would really prefer to have a way to tell the existing TextNode not to
          generate an href.

          For some background, this happens when you do a tree.subscribe("labelClick",
          ...) to handle clicks on labels. You don't want to go to a URL, and you
          don't want the default behavior (collapse/uncollapse).

          Alex

          Eric Miraglia wrote:
          >
          > suchanek_tomasz,
          >
          > The best solution for you here is to use HTMLNodes rather than the
          > TextNodes. See the TreeView documentation for more on how to use
          > HTMLNodes.
          >
          > Regards,
          > Eric
          >
          > ______________________________________________
          > Eric Miraglia
          > Yahoo! User Interface Library
          >
          >
          >
          > On Feb 1, 2007, at 7:52 AM, suchanek_tomasz wrote:
          >
          >> As written in topic. How can I omit expanding tree when labal is
          >> clicked? I want to expand/collapse nodes only when icon + - is
          >> clicked.
          >>
          >>
          >>
          >
          >
          >

          --
          View this message in context: http://www.nabble.com/Omitting-tree-expand-when-code-label-clicked-in-TreeView-tf3155643.html#a10085209
          Sent from the ydn-javascript mailing list archive at Nabble.com.


        • Alessandro Vernet
          ... Following-up on my own message, this has been taken care of in YUI 2.6.0. Great. Now the href and target attribute are just not generated if there is no
          Message 4 of 7 , Nov 12, 2008
          • 0 Attachment
            Alessandro Vernet wrote:
            >
            > So I would really prefer to have a way to tell the existing TextNode not
            > to generate an href.
            >

            Following-up on my own message, this has been taken care of in YUI 2.6.0.
            Great. Now the href and target attribute are just not generated if there is
            no href (from treeview.js):

            if (this.href) {
            sb[sb.length] = ' href="' + this.href + '"';
            sb[sb.length] = ' target="' + this.target + '"';
            }

            Excellent :).

            Alex

            -----
            Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
            Orbeon's Blog: http://www.orbeon.com/blog/
            Personal Blog: http://avernet.blogspot.com/
            Twitter - http://twitter.com/avernet
            --
            View this message in context: http://www.nabble.com/Omitting-tree-expand-when-code-label-clicked-in-TreeView-tp8750644p20455904.html
            Sent from the ydn-javascript mailing list archive at Nabble.com.
          Your message has been successfully submitted and would be delivered to recipients shortly.