Browse Source

Added Destructive Group Ability

pull/1327/head
Mehmet Can Alaca 7 years ago
parent
commit
5c9053235a
  1. 7
      Sortable.js

7
Sortable.js

@ -49,6 +49,7 @@
putSortable, putSortable,
autoScroll = {}, autoScroll = {},
destructive = false,
tapEvt, tapEvt,
touchEvt, touchEvt,
@ -265,6 +266,7 @@
store: null, store: null,
handle: null, handle: null,
allowDuplicates: true, allowDuplicates: true,
isDestructive: false,
scroll: true, scroll: true,
scrollSensitivity: 30, scrollSensitivity: 30,
scrollSpeed: 10, scrollSpeed: 10,
@ -737,6 +739,8 @@
isMovingBetweenSortable = false, isMovingBetweenSortable = false,
canSort = options.sort; canSort = options.sort;
destructive = options.isDestructive;
if (evt.preventDefault !== void 0) { if (evt.preventDefault !== void 0) {
evt.preventDefault(); evt.preventDefault();
!options.dragoverBubble && evt.stopPropagation(); !options.dragoverBubble && evt.stopPropagation();
@ -1001,6 +1005,9 @@
// drag from one list and drop into another // drag from one list and drop into another
_dispatchEvent(null, parentEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex, evt); _dispatchEvent(null, parentEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);
_dispatchEvent(this, rootEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex, evt); _dispatchEvent(this, rootEl, 'sort', dragEl, parentEl, rootEl, oldIndex, newIndex, evt);
if (destructive) {
dragEl && dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
}
} }
} }
else { else {

Loading…
Cancel
Save