coldfusion flash integration:
I am trying to allow the user a way of shifting through items in a tree 2 levels deep. This will give the user a chance to order the items within the tree so they can be sent to word in the desired sequence. I have working code for shifting through items at the lowest level but I can't get it to work correctly for the folder level items. I have some code that works okay but has a little problem. I found that if you stick with moving one folder up the tree then you won't encounter the problem. However, if you switch to a different folder to move then you will encounter the problem sooner. The problem seems to be copying a portion of the tree and appending it to the end. I don't know what exactly is happening! I was hoping that someone could help me out on this. Does anybody know a way to do this? Ohh yeah and I would like the selectedIndex to stay with the folder selected as well. (I also posted this in the ?Advanced Techniques? forum.) Thanks for your help. Jeff Code: function treeSortUp(tree, Changeprogram){ if(tree.selectedIndex != undefined && tree.selectedIndex != 0){ var folderOpenArray:Array = [0]; for(var i=0; i<tree.getLength(); i++){ var thisNode1 = tree.getTreeNodeAt(i); folderOpenArray[i] = tree.getIsOpen(thisNode1); tree.setIsOpen(thisNode1, true); } var Index = tree.selectedIndex; var First = tree.getNodeDisplayedAt(Index-1); var Second = tree.getNodeDisplayedAt(Index); if(tree.getIsBranch(Second) == true){ for(var i=0; i<tree.getLength(); i++){ if(tree.selectedNode == tree.getTreeNodeAt(i)){ <!---alert('Second: '+tree.getTreeNodeAt(i).getProperty('label')+' First: '+tree.getTreeNodeAt(i-1).getProperty('label'));---> tree.addTreeNodeAt(i-1, tree.getTreeNodeAt(i)); tree.removeTreeNodeAt(i+1); break; } if(tree.getTreeNodeAt(Index) == tree.getTreeNodeAt(i); <!--- the selected index is not working correctly ---> tree.selectedIndex = i-1; } } }else if(tree.getIsBranch(First) == false || Changeprogram == 'yes'){ tree.addItemAt(Index-1, Second); tree.addItemAt(Index, First); tree.removeItemAt(Index+1); tree.removeItemAt(Index+1); tree.selectedIndex = Index-1; } for(var i=0; i<tree.getLength(); i++){ var thisNode1 = tree.getTreeNodeAt(i); tree.setIsOpen(thisNode1, folderOpenArray[i]); } } }
Don't see what you're looking for? Try a search.
|