dragula - how to disable dragging in its parent container

3.2k Views Asked by At

I like how dragula works, but one thing I couldn't find solution to, is how I can disable the function of drag and drop in the same container the element is currently in. I only want to drag elements into other containers not sort them manually.

1

There are 1 best solutions below

1
On BEST ANSWER

You let it return false from the accept-option (a function)

This is from the ionic setup, but it's same-same:

Inside the constructor:

     dragulaService.setOptions('my-bag', {
           accepts: (el, target, source, sibling) => {
            if (!target || !source || (target == source))
              return false;
           }
     });