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

onDrop returning invalid addedIndex and removedIndex #87

Open
ouroboroscoding opened this issue Apr 25, 2022 · 1 comment
Open

onDrop returning invalid addedIndex and removedIndex #87

ouroboroscoding opened this issue Apr 25, 2022 · 1 comment

Comments

@ouroboroscoding
Copy link

Is there any way to identify containers or draggables uniquely so they don't increment each others index counts?

I have a set of Draggables in a parent Container, that themselves have Containers with child Draggables. There is no connection between the two whatsoever, it's just a tree of data, and each child branch can be re-ordered with it's sibling branches, just as each parent branch can be re-ordered with it's sibling branches.

I have given each container a unique group name, and even given each a unique dragHandleSelector, and yet when I drag anything other than the first parent, I get bad indexes from onDrop.

For example, if I try to move the 0 child in the 0 parent to the 1 index, instead of getting a removedIndex of 0 and a addedIndex of 1, I end up with 1 and 2 respectively, as if the 0 parent is 0, and the 0 child is 1, and the 1 child is 2. I get this on some level, but it makes it very hard to order the elements correctly without knowing just how many total draggables are open and adjusting accordingly. It would be much better if the containers themselves could keep track of this and not attribute draggables that are more than a level down to the total indexes.

@ouroboroscoding
Copy link
Author

On more research it seems to always be 1 off, so it's actually manageable, but still a bug I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant