-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
43 lines (31 loc) · 1.12 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function SortableCTRL($scope) {
var sortableEle;
$scope.sortableArray = [
'One', 'Two', 'Three'
];
$scope.add = function() {
$scope.sortableArray.push('Item: '+$scope.sortableArray.length);
sortableEle.refresh();
}
$scope.dragStart = function(e, ui) {
ui.item.data('start', ui.item.index());
}
$scope.dragEnd = function(e, ui) {
var start = ui.item.data('start'),
end = ui.item.index();
//console.log(start, end);
$scope.sortableArray.splice(end, 0,
$scope.sortableArray.splice(start, 1)[0]);
$scope.$apply();
}
sortableEle = $('#sortable').sortable({
start: $scope.dragStart,
update: $scope.dragEnd
}).disableSelection();
}
var sortableElm = $('.list').multisortable().disableSelection();
'activate beforeStop change create deactivate out over receive remove start stop update click'.split(' ').forEach(function(event){
sortableElm.on('multisort' + event, function(event){
console.log(event.type, arguments);
});
});