Skip to content
Snippets Groups Projects
Commit a93b6398 authored by pabois's avatar pabois
Browse files

sortable

parent a578b023
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,8 @@ window.osuny.treeView = {
invoke: function () {
'use strict';
return {
init: this.init.bind(this)
init: this.init.bind(this),
initSortable: this.initSortable.bind(this)
};
}
}.invoke();
......
......@@ -3,27 +3,4 @@ $('.js-treeview-children', $branch).html("<%= escape_javascript(render 'treebran
$branch.addClass('treeview__branch--loaded');
var nestedSortables,
i;
nestedSortables = [].slice.call(document.querySelectorAll('.js-treeview-sortable'));
for (i = 0; i < nestedSortables.length; i += 1) {
new Sortable(nestedSortables[i], {
group: 'nested',
animation: 150,
fallbackOnBody: true,
swapThreshold: 0.65,
onEnd: function (/**Event*/evt) {
console.log(evt);
var itemEl = evt.item; // dragged HTMLElement
evt.to; // target list
evt.from; // previous list
evt.oldIndex; // element's old index within old parent
evt.newIndex; // element's new index within new parent
evt.oldDraggableIndex; // element's old index within old parent, only counting draggable elements
evt.newDraggableIndex; // element's new index within new parent, only counting draggable elements
evt.clone // the clone element
evt.pullMode; // when item is in another sortable: `"clone"` if cloning, `true` if moving
},
});
}
window.osuny.treeView.initSortable();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment