Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 912
Markus Avatar asked Nov 28 '25 12:11

Markus


1 Answers

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;
           }
     });
like image 60
split Avatar answered Nov 30 '25 01:11

split