Created
October 6, 2017 04:44
-
-
Save paltman/84c49c5ba7a972e9c777fb0fb0e2378c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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