[jQuery] Sortables Update Still Showing Old Sort Position (With New Position)
Here's the code:
$("#sort1").sortable({
connectWith: ['#sort2', '#sort3'],
revert: true,
items: '.groupItem',
handle: '.itemHeader',
placeholder: 'moduleSortHelper',
start: function(e, ui) {
ui.helper.css("width", ui.item.width());
},
update: function(e, ui) {
$("#sort1").sortable("refreshPositions");
alert(ui.item.find(".moduleId").text());
$("#sort1").find(".groupItem").each(function() {
alert("1: " + $(this).find(".moduleId").text());
});
}
});
$("#sort2").sortable({
connectWith: ['#sort1', '#sort3'],
revert: true,
items: '.groupItem',
handle: '.itemHeader',
placeholder: 'moduleSortHelper',
start: function(e, ui) {
ui.helper.css("width", ui.item.width());
},
update: function(e, ui) {
$("#sort2").sortable("refreshPositions");
alert(ui.item.find(".moduleId").text());
$("#sort2").find(".groupItem").each(function() {
alert("2: " + $(this).find(".moduleId").text());
});
}
});
$("#sort3").sortable({
connectWith: ['#sort1', '#sort2'],
revert: true,
items: '.groupItem',
handle: '.itemHeader',
placeholder: 'moduleSortHelper',
start: function(e, ui) {
ui.helper.css("width", ui.item.width());
},
update: function(e, ui) {
$("#sort3").sortable("refreshPositions");
alert(ui.item.find(".moduleId").text());
$("#sort3").find(".groupItem").each(function() {
alert("3: " + $(this).find(".moduleId").text());
});
}
});
When I sort the item, it alerts its previous position as well as its
new position. I tried using "refreshPositions" but that doesn't seem
to fix this issue. Any thoughts/suggestions?