reverts JS from tree controller and updates the c# method to create the tree child node URLs to ensure the custom start node param is ignored, this is a bit cleaner.

This commit is contained in:
Shannon
2014-10-07 12:52:02 +11:00
parent b60e292d5f
commit 8824ab2b27
2 changed files with 11 additions and 27 deletions

View File

@@ -52,8 +52,15 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController",
if(dialogOptions.filter[0] === "{"){
dialogOptions.filterAdvanced = true;
}
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", function (ev, args) {
if (angular.isArray(args.children)) {
performFiltering(args.children);
}
});
}
/** Method used for selecting a node */
function select(text, id, entity) {
//if we get the root, we just return a constructed entity, no need for server data
@@ -192,30 +199,4 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController",
}
}
});
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", function (ev, args) {
//remove the custom startNodeId query string param, that is only meant to be used 1 time
// for the initial tree structure loading.
if (angular.isArray(args.children)) {
for (var child in args.children) {
var parts = args.children[child].childNodesUrl.split("&");
var childNodesUrl = "";
for (var p in parts) {
if (!parts[p].startsWith("startNodeId")) {
childNodesUrl += parts[p] + "&";
}
}
childNodesUrl = childNodesUrl.trimEnd("&");
args.children[child].childNodesUrl = childNodesUrl;
}
}
if (dialogOptions.filter) {
if (angular.isArray(args.children)) {
performFiltering(args.children);
}
}
});
});