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

simple menu for treeview (onmouseover)

Expand Messages
  • dufferdo25
    Hello all, I want to add a simple menu to each leaf of the treeview...similar to the context menu but I want it more like the tooltips where it displays
    Message 1 of 9 , Aug 28, 2008
    • 0 Attachment
      Hello all,
      I want to add a simple menu to each leaf of the treeview...similar to
      the context menu but I want it more like the tooltips where it
      displays onmouseover, not onriight click.
      I need the links to be dynamic in that they contain a function with
      the innerHTML of the tree node. Any ideas?

      Thanks...
    • Satyam
      One of the node types in TreeView is HTMLNode. You are free to mix and match node types, each node can be of a different type. You can use HTMLNodes for the
      Message 2 of 9 , Aug 29, 2008
      • 0 Attachment
        One of the node types in TreeView is HTMLNode. You are free to mix and
        match node types, each node can be of a different type. You can use
        HTMLNodes for the leaf nodes and have it filled with whatever you want,
        TreeView will take care of showing it and hiding it. You will still
        have to listen to the events fired by the HTML elements in the node,
        TreeView would know nothing about them. You can even load a node with a
        plain <div> and have another YUI widget drawn into it.

        Satyam


        dufferdo25 wrote:
        > Hello all,
        > I want to add a simple menu to each leaf of the treeview...similar to
        > the context menu but I want it more like the tooltips where it
        > displays onmouseover, not onriight click.
        > I need the links to be dynamic in that they contain a function with
        > the innerHTML of the tree node. Any ideas?
        >
        > Thanks...
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - http://www.avg.com
        > Version: 8.0.138 / Virus Database: 270.6.11/1639 - Release Date: 28/08/2008 7:39
        >
        >
        >
        >
      • dufferdo25
        Thanks, I ws trying to keep the nodes as TextNodes as I have everything working nicely now and I just want to add a simple 3 link menu to each node on the
        Message 3 of 9 , Sep 2, 2008
        • 0 Attachment
          Thanks,
          I ws trying to keep the nodes as TextNodes as I have everything
          working nicely now and I just want to add a simple 3 link menu to each
          node on the tree. Is there a simple example of using the menu on the
          treeview (not the ContextMenu example)?
          Thanks for your help.

          I tried the HTMLNode and thought I could capture mouseover and display
          the menu but I couldnt get that to work.

          TIA!


          --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
          >
          > One of the node types in TreeView is HTMLNode. You are free to mix and
          > match node types, each node can be of a different type. You can use
          > HTMLNodes for the leaf nodes and have it filled with whatever you want,
          > TreeView will take care of showing it and hiding it. You will still
          > have to listen to the events fired by the HTML elements in the node,
          > TreeView would know nothing about them. You can even load a node
          with a
          > plain <div> and have another YUI widget drawn into it.
          >
          > Satyam
          >
          >
          > dufferdo25 wrote:
          > > Hello all,
          > > I want to add a simple menu to each leaf of the treeview...similar to
          > > the context menu but I want it more like the tooltips where it
          > > displays onmouseover, not onriight click.
          > > I need the links to be dynamic in that they contain a function with
          > > the innerHTML of the tree node. Any ideas?
          > >
          > > Thanks...
          > >
          > >
          > > ------------------------------------
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > > No virus found in this incoming message.
          > > Checked by AVG - http://www.avg.com
          > > Version: 8.0.138 / Virus Database: 270.6.11/1639 - Release Date:
          28/08/2008 7:39
          > >
          > >
          > >
          > >
          >
        • dufferdo25
          Thanks, I ws trying to keep the nodes as TextNodes as I have everything working nicely now and I just want to add a simple 3 link menu to each node on the
          Message 4 of 9 , Sep 2, 2008
          • 0 Attachment
            Thanks,
            I ws trying to keep the nodes as TextNodes as I have everything
            working nicely now and I just want to add a simple 3 link menu to each
            node on the tree. Is there a simple example of using the menu on the
            treeview (not the ContextMenu example)?
            Thanks for your help.

            I tried the HTMLNode and thought I could capture mouseover and display
            the menu but I couldnt get that to work.

            TIA!


            --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
            >
            > One of the node types in TreeView is HTMLNode. You are free to mix and
            > match node types, each node can be of a different type. You can use
            > HTMLNodes for the leaf nodes and have it filled with whatever you want,
            > TreeView will take care of showing it and hiding it. You will still
            > have to listen to the events fired by the HTML elements in the node,
            > TreeView would know nothing about them. You can even load a node
            with a
            > plain <div> and have another YUI widget drawn into it.
            >
            > Satyam
            >
            >
            > dufferdo25 wrote:
            > > Hello all,
            > > I want to add a simple menu to each leaf of the treeview...similar to
            > > the context menu but I want it more like the tooltips where it
            > > displays onmouseover, not onriight click.
            > > I need the links to be dynamic in that they contain a function with
            > > the innerHTML of the tree node. Any ideas?
            > >
            > > Thanks...
            > >
            > >
            > > ------------------------------------
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            > >
            > > No virus found in this incoming message.
            > > Checked by AVG - http://www.avg.com
            > > Version: 8.0.138 / Virus Database: 270.6.11/1639 - Release Date:
            28/08/2008 7:39
            > >
            > >
            > >
            > >
            >
          • dufferdo25
            Thanks, I ws trying to keep the nodes as TextNodes as I have everything working nicely now and I just want to add a simple 3 link menu to each node on the
            Message 5 of 9 , Sep 2, 2008
            • 0 Attachment
              Thanks,
              I ws trying to keep the nodes as TextNodes as I have everything
              working nicely now and I just want to add a simple 3 link menu to each
              node on the tree. Is there a simple example of using the menu on the
              treeview (not the ContextMenu example)?
              Thanks for your help.

              I tried the HTMLNode and thought I could capture mouseover and display
              the menu but I couldnt get that to work.

              TIA!


              --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
              >
              > One of the node types in TreeView is HTMLNode. You are free to mix and
              > match node types, each node can be of a different type. You can use
              > HTMLNodes for the leaf nodes and have it filled with whatever you want,
              > TreeView will take care of showing it and hiding it. You will still
              > have to listen to the events fired by the HTML elements in the node,
              > TreeView would know nothing about them. You can even load a node
              with a
              > plain <div> and have another YUI widget drawn into it.
              >
              > Satyam
              >
              >
              > dufferdo25 wrote:
              > > Hello all,
              > > I want to add a simple menu to each leaf of the treeview...similar to
              > > the context menu but I want it more like the tooltips where it
              > > displays onmouseover, not onriight click.
              > > I need the links to be dynamic in that they contain a function with
              > > the innerHTML of the tree node. Any ideas?
              > >
              > > Thanks...
              > >
              > >
              > > ------------------------------------
              > >
              > > Yahoo! Groups Links
              > >
              > >
              > >
              > >
              > > No virus found in this incoming message.
              > > Checked by AVG - http://www.avg.com
              > > Version: 8.0.138 / Virus Database: 270.6.11/1639 - Release Date:
              28/08/2008 7:39
              > >
              > >
              > >
              > >
              >
            • Satyam
              Use MenuNode for the last level. You can mix and match Node types, there is no need to stick with any one type. MenuNodes are TextNodes that only keep one
              Message 6 of 9 , Sep 2, 2008
              • 0 Attachment
                Use MenuNode for the last level. You can mix and match Node types,
                there is no need to stick with any one type. MenuNodes are TextNodes
                that only keep one branch open at any time, in between those that are
                MenuNodes. The you subscribe to the labelClick event to know when they
                have been clicked.

                Satyam


                dufferdo25 wrote:
                > Thanks,
                > I ws trying to keep the nodes as TextNodes as I have everything
                > working nicely now and I just want to add a simple 3 link menu to each
                > node on the tree. Is there a simple example of using the menu on the
                > treeview (not the ContextMenu example)?
                > Thanks for your help.
                >
                > I tried the HTMLNode and thought I could capture mouseover and display
                > the menu but I couldnt get that to work.
                >
                > TIA!
                >
                >
                > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
                >
                >> One of the node types in TreeView is HTMLNode. You are free to mix and
                >> match node types, each node can be of a different type. You can use
                >> HTMLNodes for the leaf nodes and have it filled with whatever you want,
                >> TreeView will take care of showing it and hiding it. You will still
                >> have to listen to the events fired by the HTML elements in the node,
                >> TreeView would know nothing about them. You can even load a node
                >>
                > with a
                >
                >> plain <div> and have another YUI widget drawn into it.
                >>
                >> Satyam
                >>
                >>
                >> dufferdo25 wrote:
                >>
                >>> Hello all,
                >>> I want to add a simple menu to each leaf of the treeview...similar to
                >>> the context menu but I want it more like the tooltips where it
                >>> displays onmouseover, not onriight click.
                >>> I need the links to be dynamic in that they contain a function with
                >>> the innerHTML of the tree node. Any ideas?
                >>>
                >>> Thanks...
                >>>
                >>>
                >>> ------------------------------------
                >>>
                >>> Yahoo! Groups Links
                >>>
                >>>
                >>>
                >>>
                >>> No virus found in this incoming message.
                >>> Checked by AVG - http://www.avg.com
                >>> Version: 8.0.138 / Virus Database: 270.6.11/1639 - Release Date:
                >>>
                > 28/08/2008 7:39
                >
                >>>
                >>>
                >>>
                >
                >
                >
                > ------------------------------------
                >
                > Yahoo! Groups Links
                >
                >
                >
                > ------------------------------------------------------------------------
                >
                >
                > No virus found in this incoming message.
                > Checked by AVG - http://www.avg.com
                > Version: 8.0.169 / Virus Database: 270.6.14/1645 - Release Date: 01/09/2008 7:19
                >
                >
              • dufferdo25
                I managed to get the contextMenu to work but I have the need to create a custom property for the TextNode called name (or whatever). var myobj = {
                Message 7 of 9 , Sep 2, 2008
                • 0 Attachment
                  I managed to get the contextMenu to work but I have the need to create
                  a custom property for the TextNode called name (or whatever).

                  var myobj = { title:"label-" + n, label: n, href:"xmpp:" + n,
                  name:"name"+n };
                  oTextNode = new YAHOO.widget.TextNode(myobj, oTreeView.getRoot(), false);
                  ...
                  ...


                  Now the API states:
                  All other attributes are made available in noderef.data, which can be
                  used to store custom attributes.

                  How do I access this property?

                  I would still like to use the menu instead of the contextMenu so if
                  there are any examples, I would appreciate it.
                  TIA!
                • Satyam
                  Assuming you have a node by any means you care to, for example, as the argument from a labelClick event listener: myTree.subscribe( labelClick , function(node)
                  Message 8 of 9 , Sep 2, 2008
                  • 0 Attachment
                    Assuming you have a node by any means you care to, for example, as the
                    argument from a labelClick event listener:

                    myTree.subscribe("labelClick", function(node) {
                    alert(node.data.name + " was clicked");
                    });

                    Satyam


                    dufferdo25 wrote:
                    > I managed to get the contextMenu to work but I have the need to create
                    > a custom property for the TextNode called name (or whatever).
                    >
                    > var myobj = { title:"label-" + n, label: n, href:"xmpp:" + n,
                    > name:"name"+n };
                    > oTextNode = new YAHOO.widget.TextNode(myobj, oTreeView.getRoot(), false);
                    > ...
                    > ...
                    >
                    >
                    > Now the API states:
                    > All other attributes are made available in noderef.data, which can be
                    > used to store custom attributes.
                    >
                    > How do I access this property?
                    >
                    > I would still like to use the menu instead of the contextMenu so if
                    > there are any examples, I would appreciate it.
                    > TIA!
                    >
                    >
                    > ------------------------------------
                    >
                    > Yahoo! Groups Links
                    >
                    >
                    >
                    > ------------------------------------------------------------------------
                    >
                    >
                    > No virus found in this incoming message.
                    > Checked by AVG - http://www.avg.com
                    > Version: 8.0.169 / Virus Database: 270.6.14/1645 - Release Date: 01/09/2008 7:19
                    >
                    >
                  • dufferdo25
                    Thanks Satyam, I thought I had this contextMenu figured out but it seems that I only get a context menu on the groups and not on the individual nodes eg.. cars
                    Message 9 of 9 , Sep 2, 2008
                    • 0 Attachment
                      Thanks Satyam,
                      I thought I had this contextMenu figured out but it seems that I only
                      get a context menu on the groups and not on the individual nodes eg..

                      cars
                      --chevrolet
                      -----camaro
                      -----corvette
                      --mercedes
                      -----ml350

                      So the context is only available on cars, chevrolet and mercedes and
                      not on camaro, corvette, ml350

                      Any ideas?

                      code:
                      YAHOO.util.Event.onAvailable("rosterDiv", function () {
                      loadContextMenu();
                      });

                      var loadContextMenu = function() {
                      var oContextMenu = new YAHOO.widget.ContextMenu("mytreecontextmenu", {
                      trigger: "rosterDiv",
                      lazyload: true,
                      itemdata: [
                      { text: "Shadow", onclick: { fn: shadowClick } },
                      { text: "Chat", onclick: { fn: chatClick } },
                      { text: "Send file", onclick: { fn: fileClick } }
                      ] });
                      oContextMenu.subscribe("triggerContextMenu", onTriggerContextMenu);
                      //END MENU
                      }

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