Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion knockout-sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
var removeOperation = currentOperation.event.type === 'remove' ? currentOperation : existingOperation,
addOperation = currentOperation.event.type === 'add' ? currentOperation : existingOperation;

addOperation.event.groupOption = parentBindings.sortable.options.group;

moveItem(itemVM, removeOperation.collection, addOperation.collection, addOperation.event.clone, addOperation.event);
}
},
Expand Down Expand Up @@ -151,7 +153,13 @@
fromArray.splice(originalIndex, 1);
// Update the array, this will also remove sortables "unbound" clone
from.valueHasMutated();
if (clone && from !== to) {

var groupOption = e.groupOption;
// See the option at https://github.com/SortableJS/Sortable#options
// group: { name: 'shared', pull: 'clone' }
var cloneable = typeof groupOption === 'object' && groupOption.pull === 'clone';

if (cloneable && clone && from !== to) {
// Read the item
fromArray.splice(originalIndex, 0, itemVM);
// Force knockout to update
Expand Down