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

Re: [ydn-javascript] TreeView - Can TextNode label be made to not expand/contract the branch?

Expand Messages
  • Adam Moore
    ... Replace YAHOO.widget.TextNode with YAHOO.widget.HTMLNode to remove the label click behavior. The following example uses HTMLNode for the custom icon
    Message 1 of 5 , Nov 1, 2007
    • 0 Attachment
      On Wed, Oct 31, 2007 at 11:23:23PM -0000, dcinteractive123 wrote:
      > Hello,
      >
      > I have built a tree similar to the basic example listed here:
      >
      > http://developer.yahoo.com/yui/examples/treeview/default_tree.html
      >
      > I would like to change the behavior so that the only way to expand the
      > tree is to click on the + sign. I basically don't want to label to be
      > clickable. Is this possible?

      Replace YAHOO.widget.TextNode with YAHOO.widget.HTMLNode to remove the
      label click behavior. The following example uses HTMLNode for the
      custom icon presentation:

      http://developer.yahoo.com/yui/examples/treeview/customicons.html

      -Adam
    • Eric Miraglia
      David, You probably want to use HTMLNodes instead of TextNodes. Check out the children of the second node (Susheela s docs) in this example:
      Message 2 of 5 , Nov 1, 2007
      • 0 Attachment
        David,

        You probably want to use HTMLNodes instead of TextNodes.

        Check out the children of the second node (Susheela's docs) in this example:


        That will get you started with HTMLNodes, and I believe they'll do just what you're picturing.

        Regards,
        Eric



        ______________________________________________
        Eric Miraglia
        Yahoo! User Interface Library


        On Nov 1, 2007, at 10:27 AM, dcinteractive123 wrote:

        Hi Eric,

        Thank you for your reply. Your solution solves 1/2 of my problem. Here
        is what I am trying to do:

        The node label contains a title plus an HTML checkbox. I want the user
        to be able to check one or more nodes and then hit the submit button.
        The next page then processes their selections. The problem was that
        checking the box meant that the label was clicked and the tree would
        expand and the check box would disappear. Your solution causes the
        tree not to expand but the box doesn't stay checked either.

        Do you have any other suggestions? I've played around with adding a
        checked attribute to my text node object, and activating it when an
        onclick event on the check box, but the html checkbox doesn't have a
        reference to the node object, so I cannot turn the checkbox element on.

        Thanks,
        David

        --- In ydn-javascript@ yahoogroups. com, Eric Miraglia <miraglia@.. .> wrote:
        >
        > dcinteractive123,
        > 
        > If you return false from your labelClick handler, the label will not 
        > expand the TreeView node (but the expand/collapse icon will still work 
        > as desired). Assuming you have a TreeView instance called tree:
        > 
        > tree.subscribe( "labelClick" , function(node) {
        > return false;
        > });
        > 
        > Regards,
        > Eric
        > 
        > 
        > 
        > On Oct 31, 2007, at 4:23 PM, dcinteractive123 wrote:
        > 
        > > Hello,
        > >
        > > I have built a tree similar to the basic example listed here:
        > >
        > > http://developer. yahoo.com/ yui/examples/ treeview/ default_tree. html
        > >
        > > I would like to change the behavior so that the only way to expand the
        > > tree is to click on the + sign. I basically don't want to label to be
        > > clickable. Is this possible?
        > >
        > > Thanks!
        > >
        > >
        > >
        >


      Your message has been successfully submitted and would be delivered to recipients shortly.