Markus
Markus

Reputation: 65

dragula - how to disable dragging in its parent container

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.

Upvotes: 3

Views: 3450

Answers (1)

split
split

Reputation: 96

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;
           }
     });

Upvotes: 2

Related Questions