Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

Keep an element that is being dragged

Open jrgunawan opened this issue 12 years ago • 4 comments

I am trying to figure out if there is a way to keep the list element in the 1st Sortable when it is dragged and dropped to the 2nd Sortable. An example would be something like Layoutit!. I know there is https://github.com/RubaXa/Sortable/issues/50 that mentions the ability to clone. But the problem is when I dragover the list element to the 2nd Sortable, the list element on the 1st Sortable is moved to the 2nd Sortable even before I drop the list element, so it gives the impression that the 2nd Sortable can't receive multiple list elements that have same data and that is not true. Where could I modify this behavior so that the list element is not taken from the 1st Sortable? I looked at _onDragStart and _onDragOver but could't understand where you specify the move.

jrgunawan avatar Nov 05 '14 22:11 jrgunawan

I do not really understand your problem, you described correct behavior.

RubaXa avatar Nov 06 '14 08:11 RubaXa

Create a sample on jsbin.com And describe, how this example should work.

RubaXa avatar Nov 06 '14 08:11 RubaXa

http://jsfiddle.net/48rj8tk5/13/

What I am attempting to do:

  1. I can drop multiple elements from the First Column to the Second Column. I know I can clone the dragged element back to the First Column, but I would like to prevent the element being moved to the Second Column right away when it is dragged OVER (not DROPPED yet) to the Second Column. The effect that I would like to see is the element on the First Column stay where they are even as the element being dragged over to the Second Column, i.e: layoutit.com
  2. The First Column can only have the first 3 original elements.

jrgunawan avatar Nov 06 '14 16:11 jrgunawan

@jrgunawan try dev-branch and use next options:

Sortable.create(first, {
    group: { name: "elements", pull: "clone" },
    sort: false
});

Sortable.create(second, {
    group: { name: "elements", pull: false }
});

RubaXa avatar Nov 08 '14 19:11 RubaXa