Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable drag some element on ng2-dragula

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>
like image 472
Vitaly Menchikovsky Avatar asked Dec 14 '16 08:12

Vitaly Menchikovsky


1 Answers

find a solution:

  dragulaService.setOptions('nested-bag', {
      revertOnSpill: true,
      moves: function (el:any, container:any, handle:any):any {
        debugger
        console.log(el, container);
        return false;
      }
    });
like image 195
Vitaly Menchikovsky Avatar answered Nov 19 '22 10:11

Vitaly Menchikovsky