charlesshoults
08-07-2009, 05:01 AM
Someone please help me figure this one out.
I have an element, treeSource:XML that serves as the source for a tree component. When the XML is built, it's information is duplicated in an array collection for consistency checks. I have a canvas that displays an array of icons which are used as avatars for the people who appear in the tree. Clicking an icon changes the value in the array collection, then rebuilds the XML and points the tree to the newly rebuilt XML. This causes all items to default back to the closed state. To help fix it, the tree is examined prior to rebuilding the XML and those branches that are opened are flagged in the array collection. After the XML is rebuilt, a function compares the two and tries to open the branches to the state they were in prior to being rebuilt.
for(i=0; i<folderTree.numChildren; i++) {
if(String(treeSource.children()[i].attributes()[2])=="group") {
if(String(treeSource.children()[i].attributes()[1])=="true") {
folderTree.expandItem(treeSource.children()[i],true,false,false);
}
}
}
Unfortunately, this doesn't work. It doesn't throw any errors. Both if statements evaluate as true, it just doesn't open the branch.
I have an element, treeSource:XML that serves as the source for a tree component. When the XML is built, it's information is duplicated in an array collection for consistency checks. I have a canvas that displays an array of icons which are used as avatars for the people who appear in the tree. Clicking an icon changes the value in the array collection, then rebuilds the XML and points the tree to the newly rebuilt XML. This causes all items to default back to the closed state. To help fix it, the tree is examined prior to rebuilding the XML and those branches that are opened are flagged in the array collection. After the XML is rebuilt, a function compares the two and tries to open the branches to the state they were in prior to being rebuilt.
for(i=0; i<folderTree.numChildren; i++) {
if(String(treeSource.children()[i].attributes()[2])=="group") {
if(String(treeSource.children()[i].attributes()[1])=="true") {
folderTree.expandItem(treeSource.children()[i],true,false,false);
}
}
}
Unfortunately, this doesn't work. It doesn't throw any errors. Both if statements evaluate as true, it just doesn't open the branch.