#3172 closed bug (notabug)
UI sortables update event not firing when sorting within same div sorting in multiple sortable divs
Reported by: | ErMasca | Owned by: | paul |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | ui.sortable | Version: | 1.5.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
hope the code attached helps my bug description. I have found that when you have a layout made out of divs as "zones" and little divs within "parts". when sorting from zone to zone works just fine, but when you sort within the same div the update event doesnt fire.
$(document).ready(
function () {
var sortableChange = function(e, ui){
if(ui.sender){
var w = ui.element.width(); ui.placeholder.width(w); ui.helper.css("width",ui.element.children().width());
}
};
var sortableUpdate = function(e, ui){
if(ui.sender){
var w = ui.element.width(); ui.placeholder.width(w); ui.helper.css("width",ui.element.children().width());
var zones = $('.part').not(".ui-sortable-helper"); var wp = ; for(var x=0; x<zones.length; x++) {
if(wp.length > 0){wp+='&';}
var pid = $('#'+zones[x].id).parent(".wpzone").attr("id");
wp+=pid+'='+zones[x].id;
}
alert(wp);
}
};
$('.wpzone').sortable({
cursor: 'move', items: $('.part'), handle: $('.titlebar'), opacity:90, zIndex:10000, dropOnEmpty:true, containment:'document',
placeholder:'sortHelper', helperclass: 'sortHelper', activeclass :'sortableactive', hoverclass : 'sortHelper', appendTo: 'body', tolerance:'intersect', refreshPositions:true, connectWith: $('.wpzone'), delay:0, distance:5, scroll:true, scrollSensitivity:50, revert:true, cursorAt: {top:15,left: 10 }, start: function(e,ui) { ui.helper.css("width", ui.item.width()); }, change: sortableChange, update:sortableUpdate
});
});
Change History (3)
comment:1 Changed 15 years ago by
Component: | ui.core → ui.sortable |
---|---|
Milestone: | → TDB |
comment:2 Changed 15 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
I already see the problem here. In the sortableUpdate function, you're checking for ui.sender, which only exists if you move from one connected list to another, and later on call alert(wp), but wp isn't created without ui.sender.