angular ng-sortable how to disable drag and drop inside one draggable area

1.5k Views Asked by At

I have two tables with items. I want to be able to drag and drop items between table but not inside the same table.

How to do that?

Thank you.

1

There are 1 best solutions below

1
On

Inside your sortOptions write this accept function:

 //restrict move within table. move only across table.
    accept: function (sourceItemHandleScope, destSortableScope, destItemScope) {

            console.log("sourceItemHandleScope: ", sourceItemHandleScope);
            console.log("destSortableScope: ", destSortableScope);
            console.log("destItemScope: ", destItemScope);

            return sourceItemHandleScope.itemScope.sortableScope.$parent.$id != destSortableScope.$parent.$id;


    },

I have used console.log to view the scopes and see how to achieve it, you can delete them.