From d5572f6edfa77b3b878a5cabb11feafda395ed18 Mon Sep 17 00:00:00 2001 From: serjum Date: Mon, 10 Jul 2017 17:15:00 +0300 Subject: [PATCH] issue #1100: Fixed (in AngularJS) item reappearance when it is pulled from one list to another --- Sortable.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sortable.js b/Sortable.js index b544d4260..7600bccf7 100644 --- a/Sortable.js +++ b/Sortable.js @@ -261,7 +261,8 @@ fallbackClass: 'sortable-fallback', fallbackOnBody: false, fallbackTolerance: 0, - fallbackOffset: {x: 0, y: 0} + fallbackOffset: {x: 0, y: 0}, + isAngular: false }; @@ -872,6 +873,7 @@ }, _onDrop: function (/**Event*/evt) { + // debugger; var el = this.el, options = this.options; @@ -921,6 +923,9 @@ newIndex = _index(dragEl, options.draggable); if (newIndex >= 0) { + if (this.options.isAngular) { + dragEl.parentNode.removeChild(dragEl); + } // Add event _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex); @@ -934,6 +939,9 @@ } else { if (dragEl.nextSibling !== nextEl) { + if (this.options.isAngular) { + dragEl.parentNode.removeChild(dragEl); + } // Get the index of the dragged element within its parent newIndex = _index(dragEl, options.draggable);