我正在使用https://github.com/a5hik/ng-sortable重新排序使用拖放列表。
当我在两个列表之间移动一个项目时,我被困在获得列表id。我想知道从哪个列表开始拖动,并将其删除到哪个列表中。
<div id="list1" class="sortable-row" as-sortable="sortableOptions"
ng-model="itemsList.items1">
<div ng-repeat="item in itemsList.items1" as-sortable-item>
<div as-sortable-item-handle>{{item.Label}}</div>
</div>
</div>在下面的itemMoved()方法中,我希望获得列表id
$scope.sortableOptions = {
containment: '#sortable-container',
itemMoved: function (event) {
console.log("itemMoved()");
console.dir(event);
// Identify the list on which order changed
// Get the last and new position
// Update card position
}
};如何识别开始拖放的列表以及拖放的位置。
下面是相同的普朗克
发布于 2015-03-28 11:27:01
我再试一次。使用以下方法找到id:
console.log('From: ' + event.source.sortableScope.element[0].id);
console.log('To: ' + event.dest.sortableScope.element[0].id);我希望这能帮上忙。
同样更新了plnkr。
http://plnkr.co/edit/o0FJt4?p=preview
https://stackoverflow.com/questions/29316122
复制相似问题