Use data on the ui.item to transport the original Sortable index for the update() function. This way extensions can set/access this info in their own custom Sortable functions. see #22696

git-svn-id: https://develop.svn.wordpress.org/trunk@23067 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2012-12-05 09:04:19 +00:00
parent fc3c9a8004
commit aabaa0fb8e
1 changed files with 3 additions and 4 deletions

View File

@ -3180,8 +3180,7 @@
},
initSortable: function() {
var collection = this.collection,
from;
var collection = this.collection;
if ( ! this.options.sortable || ! $.fn.sortable )
return;
@ -3200,13 +3199,13 @@
// Record the initial `index` of the dragged model.
start: function( event, ui ) {
from = ui.item.index();
ui.item.data('sortableIndexStart', ui.item.index());
},
// Update the model's index in the collection.
// Do so silently, as the view is already accurate.
update: function( event, ui ) {
var model = collection.at( from ),
var model = collection.at( ui.item.data('sortableIndexStart') ),
comparator = collection.comparator;
// Temporarily disable the comparator to prevent `add`