From: Jason Etheridge Date: Fri, 10 Jun 2016 18:22:45 +0000 (-0400) Subject: programmatic selection of tree node still not working X-Git-Tag: sprint4-merge-nov22~159 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=872c8c2f0d98016fc1639dcc0d49300ae03e1660;p=working%2FEvergreen.git programmatic selection of tree node still not working Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js b/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js index 323288e592..6d2ebc8ca7 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js @@ -35,9 +35,20 @@ function($scope , $q , $routeParams , $window , egCore , egOrg ) { // the org tree - function init(n) { + function init(id) { $scope.treedata = [ egCore.idl.toHash( egOrg.tree() ) ]; - $scope.selected = $scope.treedata[0]; // FIXME -- why no work? + function find_org(tree,id) { + if (tree.id==id) { + return tree; + } + for (var i in tree.children) { + var child = tree.children[i]; + ou = find_org( child, id ); + if (ou) { return ou; } + } + return null; + } + $scope.selected = find_org($scope.treedata,id) || $scope.treedata[0]; // FIXME -- why no work? $scope.expandedNodes = [ $scope.treedata[0], $scope.selected ]; } init(1);