Git Product home page Git Product logo

Comments (3)

yoavaa avatar yoavaa commented on August 15, 2024

That's the way angular works - it will cycle by all the methods and properties used in a template on every digest cycle. As clicking on a node will cause a digest cycle to run, the isLeaf (among other methods) will be called a few times.

Does that cause a problem for you? If so, let me know and we can see how to resolve it.

from angular-tree-control.

idreeshaddad avatar idreeshaddad commented on August 15, 2024

I'm still in an early development phase so I don't know if this will be a performance problem once the tree starts getting bigger. Thought I'd throw this one in, just in case.

from angular-tree-control.

vambo avatar vambo commented on August 15, 2024

It does seem like a potential problem for me. I have yet to look into it more, but with a tree of 5600 (56 * 10 * 10), it behaves as follows:

  1. Reload the page, tree is built fast, expand/collapse works fast
  2. Select a node label
  3. Expand/collapse as well as everything else (e.g. entering text to input fields) has a serious delay.

PS I did verify that typing in the inputfield does trigger the isLeaf call per node.

PPS I realized that clicking on node head did not cause the "slowdown", only clicking on the label. I then tried to replace the $scope.selectNodeLabel() contents with the bare minimum I needed, e.g.

if (selectedNode.type == "MY_ROOT_TYPE") {
    this.selectNodeHead();
} else {
    $scope.onSelection({node: selectedNode, selected: true});
}

and that seems to avoid the digest cycle. There's no highlighting of the selected element but I can live with that for the moment.

from angular-tree-control.

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.