Skip to content

Commit

Permalink
Fix sortable in collections
Browse files Browse the repository at this point in the history
  • Loading branch information
rastislav-chynoransky committed Aug 16, 2024
1 parent e5227e6 commit 038d56a
Showing 1 changed file with 21 additions and 33 deletions.
54 changes: 21 additions & 33 deletions resources/views/collections/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,40 +194,28 @@
format: "yyyy-mm-dd",
language: "sk"
});
});
Sortable.create(sortable, {
handle: '.sortable-handle',
ghostClass: "sortable-ghost",
animation: 150,
dataIdAttr: 'data-id',
onEnd: function () {
$('.loader').removeClass('hidden');
$.post('/collection/sort', {
// entity: this.attr('data-entity'),
entity: $('#sortable').attr('data-entity'),
id: $('#sortable').attr('data-id'),
ids: this.toArray(),
_token: @js(csrf_token())
}, function (data) {
if('success'==data.result){
// for (id in data.orders) {
// var order = data.orders[id],
// $list = $('#sortable[data-entity=' + data.entity + '] .list-group-item[data-id=' + id + ']').attr('data-order', order);
// }
// $('#sortable[data-entity=' + data.entity + ']').each(function () {
// var $list = $(this);
// LarakitManager.sort($list);
// });
} else {
}
// larakit_toastr(data);
$('.loader').addClass('hidden');
});
}
var sortable = document.getElementById('sortable')
Sortable.create(sortable, {
handle: '.sortable-handle',
ghostClass: "sortable-ghost",
animation: 150,
dataIdAttr: 'data-id',
onEnd: function () {
$('.loader').removeClass('hidden');
$.post('/collection/sort', {
entity: $('#sortable').attr('data-entity'),
id: $('#sortable').attr('data-id'),
ids: this.toArray(),
_token: @js(csrf_token())
}, function () {
$('.loader').addClass('hidden');
});
}
});
});
</script>
Expand Down

0 comments on commit 038d56a

Please sign in to comment.