valor-software / ng2-tree

Angular tree component
http://valor-software.com/ng2-tree/index.html
MIT License
347 stars 190 forks source link

Tree always collapses when using NGRX #184

Open TKul6 opened 6 years ago

TKul6 commented 6 years ago

Hi @rychkog

I installed the new version and unfortunately I'm still experiencing difficulties using the tree. I'm loading children using Ngrx and when I load the next level the tree is collapsing back to the root node.

I found out that the setter _setFoldingType() int tree.ts calls to childrenShouldBeLoaded() and if this function returns true the node is collapsed.

The childrenShouldBeLoaded() calls to childrenWereLoaded() and here is the problem the check if the children are loaded is made only by checking the this._childrenLoadingState. while loading children using ngrx this loading state is never changed (the whole tree is changes) so the childrenWereLoaded() returns false although the children exists.

I temporary overcame this issue by adding the check !!this._children and it seems to work. Unfortunately I'm not that familiar with the source code to know if i messed up something else.

Can you please check it out?

Thanks, TMaster

TKul6 commented 6 years ago

Hi @rychkog Have you had a chance to look at the problem, it drives people here crazy,

If there something I can do to expedite the progress please tell me.

Thanks,

TKul6 commented 6 years ago

Hi @rychkog , any news? Thanks

rychkog commented 6 years ago

@TMaster I've understood the problem. Will work on this.

TKul6 commented 6 years ago

Thanks, a lot

Naikno commented 5 years ago

any news about this ?

thanks

Naikno commented 5 years ago

i tried solution proposed by @TKul6, it works only for first level of tree ..the other nodes need one more click for loading, moreover adding the control on !!this._children requires the modification of the library and it is not a solution. Does anyone have a solution for this issue??