From 872c8c2f0d98016fc1639dcc0d49300ae03e1660 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Fri, 10 Jun 2016 14:22:45 -0400 Subject: [PATCH] programmatic selection of tree node still not working Signed-off-by: Jason Etheridge --- .../web/js/ui/default/staff/admin/actor/org_unit/app.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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); -- 2.11.0