3

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.

Markus
  • 65
  • 1
  • 5

1 Answers1

2

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;
           }
     });
split
  • 96
  • 7
  • Thank you for this! I ended up using this answer to accomplish the exact opposite problem: https://codepen.io/stufu/pen/LXNdBL – Stu Furlong Nov 08 '18 at 21:17