question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scope.tree.jstree() undefined

See original GitHub issue

I don’t know if it’s the problem of jstree 3.0.9, but when installed this directive, it shows scope.tree.jstree('destroy') undefined. But when I change it to $(scope.tree).jstree('destroy') it works.

So I think before you assign the elm to scope.tree, you need to wrap it with jQuery. So I modified your function a little bit:

scope.destroy = function () {
    var j_elm = $(elm);
    if (attrs.tree) {
        if (attrs.tree.indexOf('.') !== -1) {
            var split = attrs.tree.split('.');
            scope.tree = scope.$parent[split[0]][split[1]] = j_elm;
        }
        else {
            scope.tree = scope.$parent[attrs.tree] = j_elm;
        }

    } else {
        scope.tree = j_elm;
    }
    scope.tree.jstree('destroy');
};

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
oriziscommented, Aug 21, 2016

Try to add this:

<link rel="stylesheet" href="bower_components/jstree/dist/themes/default/style.css" />
2reactions
liujoeycommented, Jan 22, 2015

ok, I found the problem. My bad, I load the javascript in a wrong sequence, the jQuery.js should be loaded before angular.js, otherwise angular will only wrap the elm object with its own jqlite. I will remove this commit from the pull request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ngJsTree TypeError: scope.tree.jstree is not a function
I have included needed dependencies and the ngJsTree module to my app.module. But this still happens: angular.js:13424 TypeError: ...
Read more >
$scope.treeInstance is undefined · Issue #36 · ezraroi/ngJsTree
my template: <div js-tree="treeConfig" ng-model="treeData" tree="treeInstance">. and got: Error: $scope.treeInstance is undefined.
Read more >
API - jsTree
a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to...
Read more >
node is undefined in function "change_state.jstree"
Ivan, I have a problem with getting node id in function "change_state.jstree". In addition, I am triggering "change_state" with "select_node" on
Read more >
rollup.js
tryCatchDeoptimization Do not turn off try-catch-tree-shaking --no-treeshake. ... rollup-plugin-my-example.js export default function myExample () { return ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found