Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
AUI-1633 - Prevent TreeNodeTask from removing 'tree-node-child-unchec…
Browse files Browse the repository at this point in the history
…ked' from Parents with Children with 'tree-node-child-unchecked' as well.
  • Loading branch information
Jonathan Mak committed Sep 21, 2014
1 parent f8cb6af commit 1aeb8ca
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/aui-tree/js/aui-tree-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1478,15 +1478,22 @@ var TreeNodeTask = A.Component.create(
instance.eachParent(
function(parentNode) {
if (isTreeNodeTask(parentNode)) {
var hasUncheckedChild = false;
var parentHasUncheckedDescendants = false;

parentNode.eachChildren(function(child) {
if ((child !== instance) && !child.isChecked()) {
hasUncheckedChild = true;
parentHasUncheckedDescendants = true;
}
else {
var childHasUncheckedChild = child.get(CONTENT_BOX).hasClass(CSS_TREE_NODE_CHILD_UNCHECKED);

if (childHasUncheckedChild) {
parentHasUncheckedDescendants = true;
}
}
});

if (!hasUncheckedChild) {
if (!parentHasUncheckedDescendants) {
parentNode.get(CONTENT_BOX).removeClass(CSS_TREE_NODE_CHILD_UNCHECKED);
}
}
Expand Down

0 comments on commit 1aeb8ca

Please sign in to comment.