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

Re: [ydn-javascript] Node.expandAll() doesn't seem to work

Expand Messages
  • Eric Miraglia
    Felix, Sorry to be dense -- I m not quite following what the bug is here. Could you bundle it up as a defect report and put it in SourceForge, including the
    Message 1 of 3 , May 11, 2007
    • 0 Attachment
      Felix,

      Sorry to be dense -- I'm not quite following what the bug is here.  Could you bundle it up as a defect report and put it in SourceForge, including the full copy of the non-functioning code?  That will help us repro and diagnose.

      Regards,
      Eric


      ______________________________________________
      Eric Miraglia
      Yahoo! User Interface Library


      On May 9, 2007, at 2:08 PM, Felix Rabinovich wrote:

      I am building a TreeView control, and want to make sure that the
      selected node is expanded. Here is the code (very close to YUI example):

      <form id="mainForm" action="javscript:;">
      <div id="treeDiv1"></div>
      </form>

      <script type="text/javascript">
      //<![CDATA[
      function treeInit() {
      var tree = new YAHOO.widget.TreeView("treeDiv1");
      var node;
      for (var i = 0; i < 4; i++) {
      node = new YAHOO.widget.TextNode("label-" + i, tree.getRoot(), false);
      for ( var j = 0; j < 10; j++ ) {
      var tmpNode = new YAHOO.widget.TextNode(node.label + "-" + j, node,
      false);
      if (i == 2 && j == 5) {
      new YAHOO.widget.TextNode("grandchild", tmpNode, false);
      tmpNode.expand(); // line 1
      node.expand(); // line 2
      }
      }
      }
      tree.draw();
      }
      YAHOO.util.Event.addListener(window, "load", treeInit);

      //]]>
      </script>

      This works fine. However, if I replace two lines with expand() above
      with a single line node.expandAll() - nothing happens. Is it me? or is
      it a bug?

      Thanks
      Felix


    • Felix Rabinovich
      in short - if (i == 2 && j == 5) { new YAHOO.widget.TextNode( grandchild , tmpNode, false); tmpNode.expand(); node.expand(); } works, but if (i == 2 && j == 5)
      Message 2 of 3 , May 11, 2007
      • 0 Attachment
        in short -

        if (i == 2 && j == 5) {
        new YAHOO.widget.TextNode("grandchild", tmpNode, false);
        tmpNode.expand();
        node.expand();
        }

        works, but

        if (i == 2 && j == 5) {
        new YAHOO.widget.TextNode("grandchild", tmpNode, false);
        node.expandAll();
        }

        doesn't work. I wasn't sure if I was missing something obvious and
        wanted to ask before posting a potentially bogus bug. Anyway, the bug
        is here
        https://sourceforge.net/tracker/?func=detail&atid=836476&aid=1717359&group_id=165715


        --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
        >
        > Felix,
        >
        > Sorry to be dense -- I'm not quite following what the bug is here.
        > Could you bundle it up as a defect report and put it in SourceForge,
        > including the full copy of the non-functioning code? That will help
        > us repro and diagnose.
        >
        > Regards,
        > Eric
        >
        >
        > ______________________________________________
        > Eric Miraglia
        > Yahoo! User Interface Library
        >
        >
        > On May 9, 2007, at 2:08 PM, Felix Rabinovich wrote:
        >
        > > I am building a TreeView control, and want to make sure that the
        > > selected node is expanded. Here is the code (very close to YUI
        > > example):
        > >
        > > <form id="mainForm" action="javscript:;">
        > > <div id="treeDiv1"></div>
        > > </form>
        > >
        > > <script type="text/javascript">
        > > //<![CDATA[
        > > function treeInit() {
        > > var tree = new YAHOO.widget.TreeView("treeDiv1");
        > > var node;
        > > for (var i = 0; i < 4; i++) {
        > > node = new YAHOO.widget.TextNode("label-" + i, tree.getRoot(), false);
        > > for ( var j = 0; j < 10; j++ ) {
        > > var tmpNode = new YAHOO.widget.TextNode(node.label + "-" + j, node,
        > > false);
        > > if (i == 2 && j == 5) {
        > > new YAHOO.widget.TextNode("grandchild", tmpNode, false);
        > > tmpNode.expand(); // line 1
        > > node.expand(); // line 2
        > > }
        > > }
        > > }
        > > tree.draw();
        > > }
        > > YAHOO.util.Event.addListener(window, "load", treeInit);
        > >
        > > //]]>
        > > </script>
        > >
        > > This works fine. However, if I replace two lines with expand() above
        > > with a single line node.expandAll() - nothing happens. Is it me? or is
        > > it a bug?
        > >
        > > Thanks
        > > Felix
        > >
        > >
        > >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.