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

Treeview add nodes in runtime.

Expand Messages
  • ivo.benedito
    Hi, I m using treeview tasknode, and the prblm i m having is to add new nodes dinamically in real time as my app is being used. I can show a little example
    Message 1 of 3 , Mar 27 8:20 AM
    • 0 Attachment
      Hi,

      I'm using treeview tasknode, and the prblm i'm having is to add new
      nodes dinamically in real time as my app is being used. I can show a
      little example like having a treeview and a button in a simple
      webpage, and every time i click that button, i add a new Root Node
      with NodeChild's. The prblm is that if the root nodes i already have
      aren't all expanded at that time, they wont be rendered and shown
      after i insert the new Root Node and it's NodeChilds. I already did a
      trick like expandeAll and then insert the new nodes and collapseAll
      after, but that isn't a solution for me since some of the Root Nodes
      have 1000+ ChildNodes and to expand that it takes a while. Does anyone
      have a stable solution for that ?? Plz, i'm stuck on this :) ...

      Thks all ...

      CODE EXAMPLE with solution that has lack of performance for large
      amount of nodes :

      function addNodes()
      {
      tree.expandAll();

      var nodeRoot = new YAHOO.widget.TaskNode("Top Node", tree.getRoot(),
      false);

      for(i=0;i<1000;i++)
      var nodeChild = new YAHOO.widget.TaskNode("layer " + i, nodeRoot,
      false);

      tree.draw();
      tree.collapseAll();
      }
    • Adam Moore
      ... Hi, in your example, try using rootNode.loadComplete() instead of tree.draw() to avoid having to expand the entire tree. This issue will be addressed in
      Message 2 of 3 , Mar 27 10:08 AM
      • 0 Attachment
        On Mon, Mar 27, 2006 at 04:20:20PM -0000, ivo.benedito wrote:
        > Hi,
        >
        > I'm using treeview tasknode, and the prblm i'm having is to add new
        > nodes dinamically in real time as my app is being used. I can show a
        > little example like having a treeview and a button in a simple
        > webpage, and every time i click that button, i add a new Root Node
        > with NodeChild's. The prblm is that if the root nodes i already have
        > aren't all expanded at that time, they wont be rendered and shown
        > after i insert the new Root Node and it's NodeChilds. I already did a
        > trick like expandeAll and then insert the new nodes and collapseAll
        > after, but that isn't a solution for me since some of the Root Nodes
        > have 1000+ ChildNodes and to expand that it takes a while. Does anyone
        > have a stable solution for that ?? Plz, i'm stuck on this :) ...

        Hi, in your example, try using rootNode.loadComplete() instead of
        tree.draw() to avoid having to expand the entire tree. This issue will
        be addressed in the next release.

        -Adam
      • ivo.benedito
        ... That doesn t work ;( ... i tried but it still not rendering all the layers that aren t expanded !! If you already tried it and had success can u put some
        Message 3 of 3 , Mar 27 10:35 AM
        • 0 Attachment
          > Hi, in your example, try using rootNode.loadComplete() instead of
          > tree.draw() to avoid having to expand the entire tree. This issue will
          > be addressed in the next release.
          >
          > -Adam

          That doesn't work ;( ... i tried but it still not rendering all the
          layers that aren't expanded !! If you already tried it and had success
          can u put some example code plz ?

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