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

Delaying node.expand() when Nodes from Array

Expand Messages
  • malutanpetronel
    I have a { ResultSet :{ Result :[ Vodka Cola , Ice Cola Red ], nodename :[ Vodka Cola , Ice Cola Red ], IsLeaf ... pointer to nodes and expand them
    Message 1 of 1 , Jun 30, 2008
    • 0 Attachment
      I have a {"ResultSet":{"Result":['Vodka Cola','Ice Cola
      Red'],"nodename":['Vodka Cola','Ice Cola Red'],"IsLeaf"
      :['1','1'],"Reference":['1','4']}} and from Result[i] I try to find
      pointer to nodes and expand them accordingly. So I do:
      for (var i=0, j=oResults1.ResultSet.Result.length; i<j; i++) {
      var id = oResults1.ResultSet.Result[i];
      var nodeToExpand = tree.getNodeByProperty("id", id);
      document.getElementById('center1').innerHTML += i + "-" + id + "-"
      + nodeToExpand + ",";
      while(nodeToExpand.expand()){}
      }
      If I comment the id, nodeToExpand, and while lines I get in that
      center1 div all the nodes needed to be iterated :

      6,0-Receipts-TaskNode (1) Receipts,1-Vodka Cola-null,2-Receipts-
      TaskNode (1) Receipts,3-Receipts-TaskNode (1) Receipts,4-Receipts-
      TaskNode (1) Receipts,5-Ice Cola Red-null,

      otherwise I get :
      6,0-Receipts-TaskNode (1) Receipts,1-Vodka Cola-null,

      so it looks that the second step in the for cycle is pointing to a
      null node which means the first node was not happen to be expanded
      (which is false cause I see it expanded)...
      If I insert a alert(id); than all is fine
      The problem is that while(nodeToExpand.expand()){} seems to not be
      the answer to my issue of waiting each nodes to be expanded... Any
      ideea how to make them wait ?

      I am very confused

      With my kind regards looking for helps in delaying the nodes above...

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