From d7945588b7349de43da039a97cf7572a2ac47083 Mon Sep 17 00:00:00 2001 From: zpgu Date: Mon, 22 Feb 2016 10:06:32 -0500 Subject: [PATCH] Added files via upload 1) jstree context menu needs {items:menuobj} 2) treeEvents using comma for specifying multiple events, to be consistent with plugin spec 3) added a callback attribute to allow complete control of getting tree data inside controller, not depending on jstree/jquery builtin --- jsTree.directive.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jsTree.directive.js b/jsTree.directive.js index c636046..735e8d7 100644 --- a/jsTree.directive.js +++ b/jsTree.directive.js @@ -51,7 +51,7 @@ ngJSTree.directive('jsTree', ['$http', function($http) { if (config.plugins.indexOf('contextmenu') >= 0) { if (a.treeContextmenu) { - config.contextmenu = s[a.treeContextmenu]; + config.contextmenu = {items: s[a.treeContextmenu]}; } } @@ -73,7 +73,7 @@ ngJSTree.directive('jsTree', ['$http', function($http) { }, manageEvents: function(s, e, a) { if (a.treeEvents) { - var evMap = a.treeEvents.split(';'); + var evMap = a.treeEvents.split(','); for (var i = 0; i < evMap.length; i++) { if (evMap[i].length > 0) { // plugins could have events with suffixes other than '.jstree' @@ -123,6 +123,11 @@ ngJSTree.directive('jsTree', ['$http', function($http) { // Fix issue #13 config.core.data = s[a.treeModel]; treeDir.init(s, e, a, config); + } else if (a.callback) { + config.core.data = function (node, cb) { + s[a.callback](node, cb); + }; + treeDir.init(s, e, a, config); } else if (a.treeAjax) { config.core.data = { 'url': a.treeAjax,