Closed hieutranagi47 closed 6 years ago
That makes sense since by the time the async ajax request completes, the sorting will have already be complete, since nothing blocks the update
callback.
You should revert the changes based on the result. Please take a look at the Promised Reverting example found in README.
Hello team,
I drag/drop an item in my nested items, and I added a http request in update function to update data to my server side, if server side return true, I do nothing, if server side return false, I'll cancel the sort, but I can not cancel the sort with ui.item.sortable.cancel().
update: function(e, ui) { updateItemToServerSide(id) .then( function(res) { return; }, function(err) { ui.item.sortable('cancel'); } ); }
updateItemToServerSide is my http service.Thanks, Hieu Tran