Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getChildNodes for Ftree Component

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
Hi Everyone (again)

I'm now having aproblem with the getChildNodes method. I've found references to a similar problem, but their solutions don't seem to work for me. What I'm trying to do is to loop through every branch on the tree and close it if it's open. Here's what I've got:
Code:
function closeAllOtherNodes(tree){
	var treeRoot = tree.getRootNode();
	trace("treeRoot's label is " + treeRoot.getLabel());
	var ArrayChildNodes = treeRoot.getChildNodes();
	trace ("result of getChildNodes(): " + treeRoot.getChildNodes());
	trace ("Number of children the root has: " + treeRoot.getNumChildren());
	trace ("the array's length: " + ArrayChildNodes.length());
	//for (child_node in ArrayChildNodes) {
	//	trace(childnode);
	//	if (child_node.isBranch() == true) {
	//		child_node.setIsOpen(false);	
	//	}
	//}
}

There's tons of trace methods in there to see what's happening, and I've commented out the actual muscle of the function. Now - it all goes fine, it tells me the right label of the root node and how many children it has, but then the array from getChildNodes just turns up empty, with a string of commas. This is incredibly similar to this topic: but their solution doesn't seem to apply to me.

Anyone?

B
 
first thought... sure you have checked for it but the empty array sounds like a whitespace problem

second thought....came across a reference to this code the other day and while i have only glanced at it it does seem to extend the tree component or at least break down the functionality into easier to follow chunks. may help ?

 
Thanks Bill

I'm not sure what you mean by a whitespace problem, so I may not have checked - could you explain a bit more?

Thanks,

B
 
You need to set the ignoreWhite property to true.

myXML = new XML();
myXML.ignoreWhite = true;

this is supposed to been fixed with player 6 but still crops up from to time.
 
Hi bill

Oh, I see - I have dealt with that issue. The tree is coming from XML, but in a weird way - I process the XML with my own scirpt to make arrays that are then set as the datasource for the tree...Maybe I should check to make sure the arrays are still around...

B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top