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 <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
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);