ng2-tree icon indicating copy to clipboard operation
ng2-tree copied to clipboard

Tree always collapses when using NGRX

Open TKul6 opened this issue 6 years ago • 6 comments

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 avatar Dec 04 '17 08:12 TKul6

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 avatar Dec 06 '17 09:12 TKul6

Hi @rychkog , any news? Thanks

TKul6 avatar Dec 14 '17 08:12 TKul6

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

rychkog avatar Feb 05 '18 08:02 rychkog

Thanks, a lot

TKul6 avatar Feb 05 '18 08:02 TKul6

any news about this ?

thanks

Naikno avatar Sep 27 '18 00:09 Naikno

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??

Naikno avatar Sep 27 '18 16:09 Naikno