Git Product home page Git Product logo

Comments (8)

ezraroi avatar ezraroi commented on June 28, 2024

When do you print the TreeInstance to the console?
if in the controller constructor it will not work, only after ready event of the tree is fired you can access it

from ngjstree.

cbalves avatar cbalves commented on June 28, 2024

I print the treeInstance in the readyCB event, just like it's done in your previous plunker example: http://plnkr.co/edit/1PHjOqojZsVlQmP819PW?p=preview

I also created a button to print its value, like the one you have in your demo - "Call Method of Tree Instance" - but since the treeInstance is undefined, I get a "TypeError: Cannot read property 'jstree' of undefined"

from ngjstree.

ezraroi avatar ezraroi commented on June 28, 2024

If you can't reproduce this in plunker, it will be very hard to for me to help. The treeInsrance property is working fine in tests and in my projects

from ngjstree.

Incognito-Nemo avatar Incognito-Nemo commented on June 28, 2024

Same problem with jquery 2.1.3, angular 1.3.15, jsTree 3.1.0…

from ngjstree.

ezraroi avatar ezraroi commented on June 28, 2024

Did you manage to reproduce on plunker?

from ngjstree.

cbalves avatar cbalves commented on June 28, 2024

Sorry for the late response. I was finally able to retrieve the treeInstance. In my case, the only solution was to use the ng-controller directive to define the controller (which I avoid using in my project):

  <div ng-controller='myCtrl'>
     <div js-tree="treeConfig" ng-model="treeData" tree="treeInstance"></div>
  </div>

I'm still unable to reproduce the working example of my first plunker or to get the treeInstance without having to use ng-controller.

Thanks a lot for your help and for this great Angular directive! Keep up the good work :)

from ngjstree.

ModuloM avatar ModuloM commented on June 28, 2024

Hi,
I had the same issue and solved it by adding ng-controller and (re)reference the instance in the controller like this:
ctrl.treeInstance = angular.element('#myDivTreeElement') (just in case it helps)

Thanks for this very usefull work!

from ngjstree.

ezraroi avatar ezraroi commented on June 28, 2024

Happy to see that the directive is being used and thanks for sharing your solutions

from ngjstree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.