Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

Question: Best way to implement 'drag out to remove/delete'?

Open jimblackler opened this issue 4 years ago • 1 comments

In my design the user can delete a list item by dragging it out of the list onto any non-interactive part of the page.

I can't see an easy way to do that. How (for instance) could I adapt one of the demos at https://sortablejs.github.io/Sortable/#simple-list to have that behavior?

jimblackler avatar Sep 20 '22 16:09 jimblackler

The built-in plugin RemoveOnSpill implements this functionality.

TL;DR

import { Sortable, OnSpill } from 'sortablejs/modular/sortable.core.esm';

Sortable.mount(OnSpill);

new Sortable(mylist, {
  removeOnSpill: true, // Enable plugin
  ...
});

mardukbp avatar May 23 '23 16:05 mardukbp