I want to display name group on the top and cancel the drag event on it. How can I disable moving some element like if this group name on the top. My code is:
dragulaService.drag.subscribe((value) => {
console.log(`drag: ${value[0]}`);
});
My template :
<div class='wrapper'>
<div class='container' *ngFor='let group of groups' [dragula]='"nested-bag"'>
<div class="center-block">Table Number : {{group.name}}</div>
<div *ngFor='let item of group.items' [innerHtml]='item.name'></div>
</div>
</div>
You need to add both functions(moves, accepts). Moves will prevent you to event start dragging the element. Accepts with sibling null will prevent other draggable elements trying to change position with the one is not in the model.
find a solution:
Since Version 2 (released 2018-07-19) you should use
dragulaService.createGroup()
instead ofdragulaService.setOptions()
:To disable dragging element with specific class:
Here is an alternative. You can use
invalid
instead ofmoves
. Taken from the documentation: