Code Monkey home page Code Monkey logo

Comments (4)

yoavaa avatar yoavaa commented on July 23, 2024

not really. The default equality function between nodes is looking at the node object members and compares them. We are not using the === operator to allow users to replace the tree data without closing all the tree.

However, you can replace the equality method easily, as it in the docs
http://wix.github.io/angular-tree-control/#equality

from angular-tree-control.

idreeshaddad avatar idreeshaddad commented on July 23, 2024

I'm sorry I didn't get what you mean by allow users to replace the tree data without closing all the tree.
So I made it into plunker http://plnkr.co/edit/uaLV66Nuse70fv74vBfV?p=preview

Clicking all the buttons, expands all the folders, adds a folder and a file to the second folder, and replaces the Sub-Folder under folder one without closing the tree.

I might have got it wrong though.

from angular-tree-control.

yoavaa avatar yoavaa commented on July 23, 2024

The question here is a design decision - what makes two tree nodes the same? how do we determine if two nodes are identical?

The design decision we made is that a node is defined by it's data members (except for the children property), as it allows to replace the node instance with another instance that is equivalent - an important feature in some cases. This is by design and not a bug.

If that does not work for you, you can do one of two things -

  1. add a unique id property to each node, like an integer or similar
  2. replace the equality function of the node with the === operator, as in the example I have linked above.

from angular-tree-control.

idreeshaddad avatar idreeshaddad commented on July 23, 2024

Yeah I got ot it.
Thanks Yoav for taking the time and responding to all the issues, I really appreciate it πŸ˜ƒ

~ Idrees

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.