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

Problem with TreeView

Expand Messages
  • M.Vishnupriya
    Hi, Im new to UI development using Yahoo UI. My requirement is that, when i click on any node of a tree present in one of the panels in the page, a particular
    Message 1 of 1 , Oct 8, 2007
    View Source
    • 0 Attachment
      Hi,

      Im new to UI development using Yahoo UI. My requirement is that,
      when i click on any node of a tree present in one of the panels in
      the page, a particular JSP page has to be loaded in an available
      <DIV>. I tried using YAHOO.util.Dispatcher.fetch() for this.. Works
      fine for the first time, but after one click, I get the following
      error


      Error: YAHOO.widget.TreeView.getNode("treeDiv1", 1) has no properties

      Here is an extract from my code..


      <script type="text/javascript">
      var tree;
      (function() {
      function treeInit() {
      buildRandomTextNodeTree();
      }

      function buildRandomTextNodeTree() {


      tree = new YAHOO.widget.TreeView("treeDiv1");
      var RtNode = new YAHOO.widget.TextNode("Test
      Application", tree.getRoot(), false);
      var DmainNode = new YAHOO.widget.TextNode("Domain",
      RtNode, false);

      var ZoeNode1 = new YAHOO.widget.TextNode("Zoe1",
      DmainNode, false);
      ZoeNode1.href="http://google.com";
      var ZoeNode2 = new YAHOO.widget.TextNode("Zoe2",
      DmainNode, false);
      var ZoeNode3 = new YAHOO.widget.TextNode("Zoe3",
      DmainNode, false);

      var chldNode11 = new YAHOO.widget.TextNode
      ("10.1.4.1", ZoeNode1, false);
      var chldNode12 = new YAHOO.widget.TextNode
      ("10.1.4.3", ZoeNode1, false);
      var chldNode21 = new YAHOO.widget.TextNode
      ("10.1.4.7", ZoeNode2, false);
      var chldNode22 = new YAHOO.widget.TextNode
      ("10.1.4.10", ZoeNode2, false);
      var chldNode31 = new YAHOO.widget.TextNode
      ("10.1.4.2", ZoeNode3, false);
      var chldNode32 = new YAHOO.widget.TextNode
      ("10.1.4.11", ZoeNode3, false);

      tree.subscribe("labelClick", function(node) {
      //alert(node.index);
      YAHOO.util.Dispatcher.fetch ( document.getElementById
      ("exPane"), 'contents.jsp' );
      });

      tree.draw();

      }

      YAHOO.util.Event.onDOMReady(treeInit);

      })();

      </script>

      Can somebody tell me where i went wrong..
    Your message has been successfully submitted and would be delivered to recipients shortly.