Skip to content

Instantly share code, notes, and snippets.

@paltman
Created October 6, 2017 04:44
Show Gist options
  • Save paltman/84c49c5ba7a972e9c777fb0fb0e2378c to your computer and use it in GitHub Desktop.
Save paltman/84c49c5ba7a972e9c777fb0fb0e2378c to your computer and use it in GitHub Desktop.
const $noteList = $('#note-list');
if ($noteList.length > 0) {
const saveUrl = $noteList.data('save-order-url');
Sortable.create($noteList[0], {
store: {
get: sortable => {
return [];
},
set: sortable => {
$.ajax({
url: saveUrl,
method: 'post',
data: {
order: sortable.toArray().join('|')
}
});
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment