Sortable: How can I remove out some item?

Created on 28 Feb 2019  路  4Comments  路  Source: SortableJS/Sortable

Problem: There are tow groups A and B, I drag an element from group A to some place not group B, where can't accept this item. Because I want remove it instead back it's old position.

I used Vue-draggable.

Most helpful comment

Now you can use the removeOnSpill plugin (included by default).

new Sortable(el, {
    removeOnSpill: true
});

All 4 comments

@big-tutu Something like this:

Sortable.create(el, {
    onEnd(evt) {
        var target = evt.originalEvent.target;
        if (el !== target && !el.contains(target)) {
            // remove `target`
        }
    }
});

A feature to solve this could be #1465

Now you can use the removeOnSpill plugin (included by default).

new Sortable(el, {
    removeOnSpill: true
});

removeOnSpill: true is good works in computer but does not work in my iphone may be same to all mobiles ? can some one help ?

Was this page helpful?
0 / 5 - 0 ratings