Zicrael / ngx-tree-dnd

Angular 7 support, data sortable draggable smart tree.
https://ngx-tree-dnd.stackblitz.io
MIT License
39 stars 11 forks source link

Multiple tree in view causing issue #44

Open sarahm7 opened 5 years ago

sarahm7 commented 5 years ago

Need help when i use multiple instance of the component the + event is not triggering on the correct component

See example codes here: https://stackblitz.com/edit/ngx-tree-dnd-pj9zw6?file=app%2Ftree%2Ftree.component.ts

Even if i clicked the + icon on the first instance, the last instance of the component gets updated instead

image

Zicrael commented 5 years ago

@sarahm7 ,

Yes, I think it required a lot of changes. I will try fix repository after I finish another new pachage ( vue-tree-dnd) and take example of code from new package, because I write it clear and smart (have much more expirience since this repo) . Thank you for download it, I am sorry for this bugs.

sarahm7 commented 5 years ago

@Zicrael thanks for the reply! i'm trying to fix it in my end but i'm not sure if the approach is good for you. I placed a rootId on the tree model so i can keep track which instance it is. im testing it now and if its good already i'll create a pull request later.

NoureddineRmila commented 5 years ago

@Zicrael we can't use this package for drag and drop an element between two trees?

Zicrael commented 5 years ago

@RmilaWeb at the current version - no:( But I hope I will fix it in next versions.

NoureddineRmila commented 5 years ago

@RmilaWeb at the current version - no:( But I hope I will fix it in next versions.

thanks for the reply! Can you tell me when the next version? Cause need this future.

hirenkukadiya commented 5 years ago

@sarahm7 can you make multiple tree? I placed a rootId on the tree model so i can keep track which instance it is. im testing it now and if its good already i'll create a pull request later. If its work then please share your experience.. and how it work.?

sarahm7 commented 5 years ago

yes i was able to do it after modifying the code. although i can't do a pull request at the moment since i'm still testing it. basically you can use it like this:

<app-tree [rootId]="1"> <app-tree [rootId]="2"> <app-tree [rootId]="3"> <app-tree [rootId]="4">

image

so the singleton tree-service can handle the event properly based on the rootId. i'm not sure if its the best solution though.

Zicrael commented 5 years ago

@sarahm7 , @hirenkukadiya Thank you for support this. I don`t have so much time now for package, but I can make you collabarators. Also I almost finish new plugin for vue. Better, faster, a lot of functionality, I share it with you guys.