Drag and drop whole table row

1.5k views Asked by At

I am using this plugin: http://codef0rmer.github.io/angular-dragdrop/#/ for drag and drop purpose. I am unable to drag and drop a table row. Following code only works for individual column. Can anyone help me on this?

<table >
            <tr>
                <th>title</th>
                <th>Category</th>
            </tr>
            <tr ng-repeat="item in list5" >
                <td data-drag="{{item.drag}}" data-jqyoui-options="{revert: 'invalid', helper: 'clone'}" ng-model="list5" jqyoui-draggable="{index: {{$index}},placeholder:true,animate:true}">{{item.title}}</td>
                <td data-drag="{{item.drag}}" data-jqyoui-opti`enter code here`ons="{revert: 'invalid'}" ng-model="list5" jqyoui-draggable="{index: {{$index}},placeholder:true,animate:true}">{{item.category}}</td>
            </tr>
        </table>
2

There are 2 answers

0
NItesh Shrestha On

I found the solution for my problem at the end of the day and it goes like this:

<tr ng-repeat="item in list5" data-jqyoui-options="{revert: 'invalid', helper: 'clone',cursor: 'move'}" data-drag='true' ng-model="list5" jqyoui-draggable="{index: {{$index}},placeholder:true,animate:true}" ng-hide="!item">
                <div ng-show='!list5.length' class='label-warning'>No content. Please add the items</div>
                <td>{{item.title}}</td>
                <td>{{item.category}}</td>
            </tr> 
0
Sanjib Saha On

I have a solution for table row sorting (drag-drop) using angular drag-drop plugin. It must be worked for you.

<tr ng-repeat="item in list5" data-drop="true" data-drag="true"
        ng-model="list5"
        jqyoui-droppable="{index: {{$index}}}" 
        jqyoui-draggable="{index: {{$index}}, insertInline: true, direction:'jqyouiDirection'}"
        data-jqyoui-options="{revert: 'invalid',helper: 'clone',zIndex: 350}"
        data-direction="{{item.jqyouiDirection}}">              
     <td>{{item.title}}</td>
     <td>{{item.category}}</td>
</tr>

You can also see my plunker code - https://plnkr.co/edit/rLEGOa4msgrjKMiCyVC1?p=info