Giter Club home page Giter Club logo

Comments (9)

adamkleingit avatar adamkleingit commented on May 24, 2024

This is a design issue. I hope to solve it soon.
Currently you can solve it by passing a new nodes object (a different "pointer").
So for example:
nodes = [...nodes];
The only problem is that it resets the tree state in terms of which node is expanded / selected / etc.

from angular-tree-component.

dmitrynovik avatar dmitrynovik commented on May 24, 2024

Yes, this is a big issue. It makes the tree static

from angular-tree-component.

adamkleingit avatar adamkleingit commented on May 24, 2024

Hey, just pushed a new version (1.1.12) which allows to update the tree using an update() method on the treeModel.

See documentation:
https://angular2-tree.readme.io/v1.1.12/docs/changing-the-tree

Can you verify it works?

from angular-tree-component.

adamkleingit avatar adamkleingit commented on May 24, 2024

Anyone verified? I want to close the issue
@sheff146 ?

from angular-tree-component.

dmitrynovik avatar dmitrynovik commented on May 24, 2024

Yes it works, great job.

On Wed, Aug 10, 2016 at 12:39 AM, adam klein [email protected]
wrote:

Anyone verified? I want to close the issue


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#18 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI29pKLuzKwMF24b7tuUahVQwfnwNXfrks5qeJEsgaJpZM4JTlFR
.

from angular-tree-component.

dmitrynovik avatar dmitrynovik commented on May 24, 2024

Adam, can I still suggest an improvement? The current solution is the update model must be called outside of component by the consumer code via #variable and @ViewChild, which is working technically but a bit "hacky". I wonder if component itself could watch for the underlying collection change and update its model seamlessly so that the consumer just could just data bind to root nodes once and relax?

from angular-tree-component.

 avatar commented on May 24, 2024

Hi,
The tree does a shallow compare (using ngOnChanges), and in case the
'nodes' attribute changes, it will update automatically.

So in case you're dealing with immutable objects u don't need to call
'update' explicitly.

I wouldn't say using the ViewChild ref is hacky, it depends on the
conventions of the project and the team.

I just don't want to do a deep comparison every time the change detection
runs cause that would be very inefficient - that's the Angular1 way...

On Aug 11, 2016 01:33, "dmitrynovik" [email protected] wrote:

Adam, can I still suggest an improvement? The current solution is the
update model must be called outside of control by the consumer code via
#variable and @ViewChild https://github.com/ViewChild, which is working
technically but a bit "hacky". I wonder if control component itself could
watch for the underlying collection change and update its model seamlessly
so that the consumer just could just data bind to root nodes once and relax?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#18 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUsQ4vkNgm6isSq_doC6usvNck-x-kZks5qelG7gaJpZM4JTlFR
.

from angular-tree-component.

dmitrynovik avatar dmitrynovik commented on May 24, 2024

What I mean is ideally the component is self-contained and, if data-bound,
is able to detect the collection changes itself requiring no outside code.

I'll leave the performance considerations to you - definitely a tree is
recursive and can be potentially very deep and large in some cases... but
probably it still should better be configurable via settings... for
example, the user might want to choose between { autoUpdate: true } - a
tree which does watch its every data item, suitable for smaller trees, or
choosing not to have it when dealing with very large collections.

On Thu, Aug 11, 2016 at 4:08 PM, 500Tech [email protected] wrote:

Hi,
The tree does a shallow compare (using ngOnChanges), and in case the
'nodes' attribute changes, it will update automatically.

So in case you're dealing with immutable objects u don't need to call
'update' explicitly.

I wouldn't say using the ViewChild ref is hacky, it depends on the
conventions of the project and the team.

I just don't want to do a deep comparison every time the change detection
runs cause that would be very inefficient - that's the Angular1 way...

On Aug 11, 2016 01:33, "dmitrynovik" [email protected] wrote:

Adam, can I still suggest an improvement? The current solution is the
update model must be called outside of control by the consumer code via
#variable and @ViewChild https://github.com/ViewChild, which is
working
technically but a bit "hacky". I wonder if control component itself could
watch for the underlying collection change and update its model
seamlessly
so that the consumer just could just data bind to root nodes once and
relax?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/500tech/angular2-tree-component/
issues/18#issuecomment-239025381>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACUsQ4vkNgm6isSq_
doC6usvNck-x-kZks5qelG7gaJpZM4JTlFR>

.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#18 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI29pH7rik7ScVC9UIA9WOYb2JPpL9Iuks5qerxAgaJpZM4JTlFR
.

from angular-tree-component.

 avatar commented on May 24, 2024

I will definitely add meta-level configuration, like setting the tree
component's changeDetectionStrategy and viewEncapsulation.
I guess autoWatch: true could be one of them.....

On Thu, Aug 11, 2016 at 9:26 AM, dmitrynovik [email protected]
wrote:

What I mean is ideally the component is self-contained and, if data-bound,
is able to detect the collection changes itself requiring no outside code.

I'll leave the performance considerations to you - definitely a tree is
recursive and can be potentially very deep and large in some cases... but
probably it still should better be configurable via settings... for
example, the user might want to choose between { autoUpdate: true } - a
tree which does watch its every data item, suitable for smaller trees, or
choosing not to have it when dealing with very large collections.

On Thu, Aug 11, 2016 at 4:08 PM, 500Tech [email protected] wrote:

Hi,
The tree does a shallow compare (using ngOnChanges), and in case the
'nodes' attribute changes, it will update automatically.

So in case you're dealing with immutable objects u don't need to call
'update' explicitly.

I wouldn't say using the ViewChild ref is hacky, it depends on the
conventions of the project and the team.

I just don't want to do a deep comparison every time the change detection
runs cause that would be very inefficient - that's the Angular1 way...

On Aug 11, 2016 01:33, "dmitrynovik" [email protected] wrote:

Adam, can I still suggest an improvement? The current solution is the
update model must be called outside of control by the consumer code via
#variable and @ViewChild https://github.com/ViewChild, which is
working
technically but a bit "hacky". I wonder if control component itself
could
watch for the underlying collection change and update its model
seamlessly
so that the consumer just could just data bind to root nodes once and
relax?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/500tech/angular2-tree-component/
issues/18#issuecomment-239025381>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACUsQ4vkNgm6isSq_
doC6usvNck-x-kZks5qelG7gaJpZM4JTlFR>

.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/500tech/angular2-tree-component/
issues/18#issuecomment-239080681>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AI29pH7rik7ScVC9UIA9WOYb2JPpL9Iuks5qerxAgaJpZM4JTlFR>
.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#18 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUsQ9O-RoxN_v1wQ2GWIeUHCIrF6Rn7ks5qesCfgaJpZM4JTlFR
.

Adam Klein
CTO & Co-Founder
Tel. +972-52-747-5633
blog.500tech.com http://blog.500tech.com
meetup.com/angularjs-il

from angular-tree-component.

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.