angularjs - ng-sortable How to get the list id while item is reordered -
i using https://github.com/a5hik/ng-sortable
reorder list using drag , drop.
i stuck @ getting list id
when move item between 2 list. want know list drag started , dropped.
<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>
in following itemmoved()
method want list id
$scope.sortableoptions = { containment: '#sortable-container', itemmoved: function (event) { console.log("itemmoved()"); console.dir(event); // identify list on order changed // last , new position // update card position } };
how identify list on drag started , on drop made.
here plnkr same
i debugged little more. found id using following:
console.log('from: ' + event.source.sortablescope.element[0].id); console.log('to: ' + event.dest.sortablescope.element[0].id);
i hope helps someone.
updated plnkr same.
Comments
Post a Comment