diff --git a/js/Plugin/jstree/hm.jstree.js b/js/Plugin/jstree/hm.jstree.js index 9a82c5a6a145610363c6c62a21e179cb281c470c..2c78763efe057edcdafa1e6da4b59f9f389d524b 100644 --- a/js/Plugin/jstree/hm.jstree.js +++ b/js/Plugin/jstree/hm.jstree.js @@ -54,7 +54,24 @@ "multiple": false, }, search: { - show_only_matches: true + show_only_matches: true, + "search_callback": function(str, node) { + //search for any of the words entered + var word, words = []; + var searchFor = str.toLowerCase().replace(/^\s+/g, '').replace(/\s+$/g, ''); + if (searchFor.indexOf(' ') >= 0) { + words = searchFor.split(' '); + } else { + words = [searchFor]; + } + for (var i = 0; i < words.length; i++) { + word = words[i]; + if ((node.text || "").toLowerCase().indexOf(word) >= 0) { + return true; + } + } + return false; + } }, plugins: ["search", "dnd"] });