tree sync actually works now

This commit is contained in:
perploug
2013-10-10 19:44:06 +02:00
parent a5522188ca
commit 7599a68c90
2 changed files with 12 additions and 10 deletions

View File

@@ -150,19 +150,20 @@ angular.module("umbraco.directives")
//watch for path changes
scope.$watch("path", function (newVal, oldVal) {
if(!scope.tree || newVal){
loadTree();
//resetting the path destroys the tree
if(newVal && newVal !== oldVal){
scope.tree = null;
}
});
//watch for active tree changes
scope.$watch("activetree", function (newVal, oldVal) {
if(!scope.tree){
loadTree();
}else if (newVal && newVal !== oldVal) {
if (newVal && newVal !== oldVal) {
scope.tree = null;
//only reload the tree data and Dom if the newval is different from the old one
loadTree();
}
});
@@ -176,6 +177,11 @@ angular.module("umbraco.directives")
}
});
//When a section is double clicked
scope.$on("tree.clearCache", function (evt, data) {
treeService.clearCache(data.tree);
scope.tree = null;
});
};
}

View File

@@ -140,10 +140,6 @@ angular.module("umbraco.directives")
scope.loadChildren(null, scope.node, true);
}else if( !node.metaData.treeAlias && activePath.indexOf(node.id) >= 0){
scope.loadChildren(null, scope.node, true);
scope.path = activePath.filter( function(element) {
return listToDelete.indexOf(obj.id) === -1;
});
}
}
};