You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. In your demo for sorting photos I am unable to drag a photo to the end of the photo list. It will either go before or back to where it was.
In my scenario it was one image per row so a simple fix was updating the _onDrop function as follows:
_onDrop: function(droppable, ui) {
// Move the dragged item to the new position in the DOM
// and rearrange the items.
// Need to use .detach() to keep the event listeners added
// by jQuery UI.
var draggable = $(ui.draggable);
var movedItem = draggable.detach();
//put if else check for movedItem.insertBefore() where it only puts the draggable object after
//if its row id is less than the droppable object's row id
if(draggable.attr("data-row-id") < $(droppable).attr("data-row-id")){
movedItem.insertAfter(droppable);
}
else{
movedItem.insertBefore(droppable);
}
this.arrange();
// Trigger event so that third parties have a chance to process the result.
this._trigger('afterDrop', null, this.element);
}
Hope this helps. Thanks for the library.
The text was updated successfully, but these errors were encountered:
Hello. In your demo for sorting photos I am unable to drag a photo to the end of the photo list. It will either go before or back to where it was.
In my scenario it was one image per row so a simple fix was updating the _onDrop function as follows:
_onDrop: function(droppable, ui) {
// Move the dragged item to the new position in the DOM
// and rearrange the items.
// Need to use .detach() to keep the event listeners added
// by jQuery UI.
var draggable = $(ui.draggable);
var movedItem = draggable.detach();
Hope this helps. Thanks for the library.
The text was updated successfully, but these errors were encountered: