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

Items are always cloned when moving between different sortables #7

Open
patrickguenther opened this issue Aug 8, 2017 · 1 comment

Comments

@patrickguenther
Copy link

patrickguenther commented Aug 8, 2017

The problem seems to be in knockout-sortable.js line 124:

moveItem(itemVM, removeOperation.collection, addOperation.collection, addOperation.event.clone, addOperation.event);

The fourth parameter seems to be the DOM-node of the hovering element when pulling an item from a list, but the function call expects a boolean value from options object that tells sortablejs whether or not the item should be cloned when moving to another list. Since a DOM node is a truthy value the items are always cloned.
Since I don't use cloning elements in my code I hardcoded that line to

moveItem(itemVM, removeOperation.collection, addOperation.collection, /**addOperation.event.clone*/false, addOperation.event);

for now but it's not pretty.

@carlstent
Copy link

carlstent commented Aug 7, 2019

the fix doesn't work if option.pull is a function.

replace line on 159 to fix with:

var cloneable = typeof groupOption === 'object' && (typeof groupOption.pull === "function" ? groupOption.pull(e.to, e.from, clone, e) : groupOption.pull) === 'clone';

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

2 participants