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

Dragging same item in same ordered list causes duplicate #2

Open
matthewpomar opened this issue Mar 5, 2018 · 5 comments
Open

Dragging same item in same ordered list causes duplicate #2

matthewpomar opened this issue Mar 5, 2018 · 5 comments

Comments

@matthewpomar
Copy link

Great component. I am trying to implement into my project and I noticed a possible defect. If you drag any item in a given ordered list from top to bottom, it duplicates the item, instead of moving it:

https://www.screencast.com/t/PPjBD4HlDx4

Any ideas where I can fix this?

@vc4u
Copy link
Contributor

vc4u commented Jun 24, 2018

@matthewpomar Did you find any workaround for the duplication issue?

@rapsacnz
Copy link
Owner

Can you confirm this is still happening? I thought I'd resolved this one.

@vc4u
Copy link
Contributor

vc4u commented Jun 24, 2018

Yes it is occurring. The way I resolved it is adding this bit of code in handleOnDropParent helper method:

var tar = event.target;
while(tar !== undefined && tar.tagName !== 'li' && tar.tagName !== 'LI'){
      tar = tar.parentElement;
}

And then in the same function replaced:
var receivingItem = this.getItem(event.target.id,items);
with
var receivingItem = this.getItem(tar.id,items);

Looks a dirty fix, but seems to hold good :-) ...

@rapsacnz
Copy link
Owner

A dirty fix is better than no fix! Esp is I'm pushed for time - I'll add it to the code (or you can submit a pull request if you want be be a contributor ;) )

@vc4u
Copy link
Contributor

vc4u commented Jun 24, 2018

Sure. I'll add my fix :-) ... your component is really good, gr8 work.

vc4u added a commit to vc4u/DualSelect that referenced this issue Jun 24, 2018
Proposed fix for the opened issue: "Dragging same item in same ordered list causes duplicate rapsacnz#2".
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

3 participants