Bug Tracker

Modify

Ticket #1958 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

UI.sortables does not call the callback update

Reported by: aldur Owned by: paul
Priority: minor Milestone: 1.2.2
Component: ui Version: 1.2.1
Keywords: UI sortable callback fix Cc:
Blocking: Blocked by:

Description

The following code should call the callback function stopDrag but it doesn't.

$("ul.reorder").sortable({stop: stopDrag});
function stopDrag(e,ui) { alert("updated");}

add the following line at line 190 of ui.sortable.js

$(this.element).triggerHandler("sortstop", [e, that.prepareCallbackObj(this)], o.stop);

and it works

Change History

comment:1 Changed 5 years ago by aldur

oops tested more here is the updated stop function in total notice that the condition inside the stopit function has been removed and the condition added around the call for the callback

stop: function(that, e) {			
			
			var o = this.options;
			var self = this;
			

			if(o.smooth) {
				var os = $(this.element).offset();
				o.beQuietAtEnd = true;
				$(this.helper).animate({ left: os.left - o.po.left, top: os.top - o.po.top }, 500, stopIt);
			} else {
				stopIt();
			}
				
			function stopIt() {

				$(self.element).css('visibility', 'visible');
				if(that.helper) that.helper.remove();
				if(self.helper != self.element) $(self.helper).remove(); 

				if(o.ozIndex)
					$(self.helper).css('zIndex', o.ozIndex);
			}
			if($(self.element).prev()[0] != that.firstSibling) {
				$(this.element).triggerHandler("sortstop", [e, that.prepareCallbackObj(this)], o.stop);
			}

			return false;
			
		}

comment:2 Changed 5 years ago by paul

  • Owner set to paul
  • Status changed from new to assigned

comment:3 Changed 5 years ago by paul

  • Status changed from assigned to closed
  • Resolution set to fixed

works in 1.5a (or current SVN).

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.