Ask a Question related to Coldfusion Flash Integration, Design and Development.
-
jedale #1
Sorting tree items manually
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]);
}
}
}
jedale Guest
-
coloring items in a tree
I have a tree that uses a cell renderer to change the font color of the tree. The only time the items actually change colors is when the mouse goes... -
Flex Tree data sorting
Did anybody try to sort data in flex tree in alphabetical order??? HOw to do it? I have just a number of groups (root nodes) and a number if... -
client side sorting of datagrid items
Does anyone know if there's code out there to manage client-side sorting of datagrid items? I'd like to be able to fill a datagrid with records... -
Array Sorting, 2 items...
Hi, Trying to accomplish: I want to sort my array by two columns. The array is setup: Array ( => Array ( -
[PHP] Array Sorting, 2 items...
> -----Original Message----- Well, erm, maybe I've got the wrong glasses on today, or maybe you've made a cut'n'paste boo-boo, but it sure looks... -



Reply With Quote

