a5hik / ng-sortable

AngularJS Library for Drag and Drop, supports Sortable and Draggable. Supports Touch devices.

Home Page:http://a5hik.github.io/ng-sortable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Restricting Sort to nested tbody

c5racing opened this issue · comments

I'm trying to restrict rows in a table from being inserted into a different section or different .

<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Description</th>
            <th></th>
        </tr>
    </thead>
    <tbody data-ng-repeat="category in vm.categories" data-as-sortable="vm.dragControlListeners" data-ng-model="category.items">
        <tr>
            <td colspan="3">{{category.name}}&nbsp;</td>
        </tr>
        <tr data-ng-repeat="item in category.items" data-as-sortable-item>
            <td>{{item.Name}}</td>
            <td>{{item.Description}}</td>
            <td data-as-sortable-item-handle>
                <i class="drag-drop-handle icon-resize-vertical"></i>
            </td>
        </tr>
    </tbody>
</table>

How can I keep an item in one category from being added to a different category in the above example?

Should have read the instructions better.

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