From: Bill Erickson Date: Tue, 3 Apr 2012 19:14:35 +0000 (-0400) Subject: Org unit custom tree sort repairs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=aaa18533b331f918e8f23c6ccaf085af1a83590c;p=evergreen%2Ftadl.git Org unit custom tree sort repairs Repairs a problem with detecting and storing the sort order of sibling nodes within custom trees. The original problem was the result of comparing parent nodes for non-siblings because of a depth-first tree traversal. Now we process siblings in level-order before processing child nodes. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/web/js/ui/default/conify/global/actor/org_unit_custom_tree.js b/Open-ILS/web/js/ui/default/conify/global/actor/org_unit_custom_tree.js index 695a9c4685..909de62806 100644 --- a/Open-ILS/web/js/ui/default/conify/global/actor/org_unit_custom_tree.js +++ b/Open-ILS/web/js/ui/default/conify/global/actor/org_unit_custom_tree.js @@ -169,9 +169,12 @@ function applyChanges2() { var prevTn; var progress = 0; + // flatten child nodes into a level-order (by parent) list + var nodeList = [magicTree.rootNode]; function flatten(node) { - nodeList.push(node); - dojo.forEach(node.getChildren(), flatten); + var kids = node.getChildren(); + nodeList = nodeList.concat(kids); + dojo.forEach(kids, flatten); } flatten(magicTree.rootNode);