Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nesting more than one deep gets events for all parent container #5

Open
crouchingkiwi opened this issue Apr 30, 2018 · 4 comments
Open
Labels
bug Something isn't working

Comments

@crouchingkiwi
Copy link

Hi

I have been trying to use your smooth-dnd for a hierarchical data set but if I have more than 1 deep nesting I get onDrop events for all containers and not just the source and destination.

I have modified your demo to include an extra nesting and this results in the following dropResults :

  1. container 3 : removedIndex: null, addedIndex: 0
  2. container 2 : removedIndex: null, addedIndex: 2
  3. container 1 : removedIndex: 4, addedIndex: 4

I would have expected

  1. container 3 : removedIndex: null, addedIndex: 0
  2. container 1 : removedIndex: 4, addedIndex: null

I have attached the modified file for clarification

Thanks

nested.zip

ps Works really nicely otherwise, great module

@kutlugsahin
Copy link
Owner

Hi @crouchingkiwi,
Thanks for the comment and bringing up the issue. I will check it asap.

@kutlugsahin kutlugsahin added the bug Something isn't working label Apr 30, 2018
@crouchingkiwi
Copy link
Author

Thanks, really appreciate it

@kutlugsahin
Copy link
Owner

Hi @crouchingkiwi,
Its because you are using the same groupName for all nested containers. This means that the containers can exchange draggables between each other. I dont know if you intended to do this particular scenario but exchanging draggables between nested containers is not supported completely right now and can cause bugs. removing groupName props and making them self contained containers fixes the issue. But I will try to enhance the code to support this behavior in the future releases.

@crouchingkiwi
Copy link
Author

Hi @kutlugsahin
Thanks for getting back to me. Yes, the intention was to be able to drag between any level of nesting, for example a directory hierarchy of file/photo objects. Thanks for your support and look forward to a future release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants