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

Re: [ydn-javascript] TreeView this.getEl() error

Expand Messages
  • Eric Miraglia
    Robert, Make sure that you have an element on the page with an id attribute of treeDiv1. In other words, the following code will work: var tree;
    Message 1 of 2 , Dec 30, 2006
    • 0 Attachment
      Robert,

      Make sure that you have an element on the page with an id attribute of treeDiv1.  In other words, the following code will work:

      <script>
              var tree;
              function initTempMenu()
              {
             
                  tree = new YAHOO.widget.TreeView("treeDiv1");
                  var root = tree.getRoot();
                  var tmpNode = new YAHOO.widget.TextNode("mylabel1", root, false);
                  var tmpNode2 = new YAHOO.widget.TextNode("mylabel1-1", tmpNode, false);
                 
                  tree.draw();
              }
             
              YAHOO.util.Event.addListener(window, "load", initTempMenu );
      </script>
      <body>
      <div id="treeDiv1"></div>
      </body>


      Regards,
      Eric
      ______________________________________________
      Eric Miraglia
      Yahoo! User Interface Library



      On Dec 29, 2006, at 7:33 AM, Heise, Robert wrote:


      Im trying to create a very basic Treeview menu and receiving a javascript error:  this.getEl() has no properties.  Heres is my htm page with the script source:

      <link rel="stylesheet" type="text/css" href="/inventorymanagement/styles/tree.css">
      <script type="text/javascript" src="/inventorymanagement/scripts/yahoo.js"></script>
      <script type="text/javascript" src="/inventorymanagement/scripts/event.js"></script>
      <script type="text/javascript" src="/inventorymanagement/scripts/treeview.js"></script>

      <script>
              var tree;
              function initTempMenu()
              {
             
                  tree = new YAHOO.widget.TreeView("treeDiv1");
                  var root = tree.getRoot();
                  var tmpNode = new YAHOO.widget.TextNode("mylabel1", root, false);
                  var tmpNode2 = new YAHOO.widget.TextNode("mylabel1-1", tmpNode, false);
                 
                  tree.draw();
              }
             
              YAHOO.util.Event.addListener(window, "load", initTempMenu );
      </script>

      hey there



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