2017-02-02 4 views
3

AnglesJS 2でネストされたng-dragulaを使用する必要があります。Angular2:ng2-dragula-nested dragula

スチューデント1 BOOK1 BOOK2 BOOK3

スチューデント2 book4 book5 book6

学生3 book7 book8 book9

I生徒位置を、ドラッグアンドドロップする必要がどの私は以下のコードでそれを行うことができます。

<div [dragula]='"student-bag"' [dragulaModel]='studentList'> 
    <div class="row" *ngFor="let student of studentList; let stud = index"> 
     ... 
    </div> 
</div> 

私は学生でだけでなく、学生の間で&は本をドラッグ&ドロップすることがあります。以下のようなもの。

スチューデント1 BOOK1 BOOK3 BOOK2

スチューデント2 book4 book5

学生3 book7 book6 book8 book9

Iが試しコード

<div [dragula]='"student-bag"' [dragulaModel]='studentList'> 
    <div class="row" *ngFor="let student of studentList; let stud = index"> 
     ... 
     <div [dragula]='"book-bag"' [dragulaModel]='student.books'> 
      <div class="row" *ngFor="let book of student.books; let bk= index"> 
       .... 
      </div> 
     </div> 
    </div> 
</div> 

ただし、書籍アイテムは学生内でも学生間でもドラッグできません。提案してください。

答えて

0

ちょうど同じ質問がありました。答えは動いている。 https://github.com/bevacqua/dragula/issues/31

var drake_books = dragula({ 
    isContainer: function (el) { 
     return el.classList.contains('student'); 
    }, 
    moves: function(el, container, target) { 
     return target.classList.contains('book'); 
    } 
    }); 
関連する問題