ezraroi / ngJsTree

Angular Directive for the famous JS Tree
http://ezraroi.github.io/ngJsTree/
MIT License
270 stars 101 forks source link

search in Firefox causing unresponsive script window popup #117

Open HarryF514 opened 7 years ago

HarryF514 commented 7 years ago

Here is the full message from the pop up window:

A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.

Script: http://localhost:9000/bower_components/jquery/dist/jquery.js:406

there are around 427 nodes in the tree structure. It mostly happened when we do a second search.

here is code I wrote:

scope.$watch('searchTerm', function(newValue, oldValue) {
                if (newValue !== oldValue) {
                    $scope.$broadcast('toggle-loader', true);
                    var searchTerm = newValue.trim();
                    if (searchTerm.length) { 
                        $scope.subgroupTree.treeInstance.jstree(true).search(searchTerm);
                    } else {
                        $scope.subgroupTree.treeInstance.jstree(true).clear_search();
                    }
                }

            });