Skip to main content

Search and Top Navigation

#8842 closed bug (notabug)

Opened November 22, 2012 11:29AM UTC

Closed November 29, 2012 01:39PM UTC

Last modified November 29, 2012 04:21PM UTC

Sortable ui.sender is null in stop

Reported by: jplevene Owned by: jplevene
Priority: minor Milestone: 1.10.0
Component: ui.sortable Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:
Description

see http://jsfiddle.net/39ZvN/6/

When dragged from another list, ui.sender is null in stop.

Attachments (0)
Change History (8)

Changed November 23, 2012 04:52PM UTC by tj.vantoll comment:1

owner: → jplevene
status: newpending

Hi jplevene. Thanks for taking the time to contribute to the jQuery UI project!

The test case you provided is using jQuery 1.8.7. Can you please try your example on the latest version to see if the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/ZgAqH/ Open the link and click to "Fork" (in the top menu) to get started.

Changed November 28, 2012 02:29PM UTC by jplevene comment:2

_comment0: I have tried it with the latest JQuery and JQuery UI on my PC and still the same error. At the time of writing this, there is a problem with the jfiddle servers, in that it would not load. I will try to do a jfiddle example as asked another time when jfiddle is hopefully working again.1354113068139345
status: pendingnew

I have tried it with the latest JQuery and JQuery UI on my PC and still the same error. At the time of writing this, there is a problem with the jfiddle servers, in that it would not load. I will try to do a jfiddle example as asked another time when jfiddle is hopefully working again.

(I need to use jfiddle to get the code I used)

Changed November 29, 2012 02:41AM UTC by tj.vantoll comment:3

status: newpending

jsFiddle should be back up.

Changed November 29, 2012 09:52AM UTC by jplevene comment:4

_comment0: New jfiddle http://jsfiddle.net/jplevene/FEbxQ/2/1354182984454846
status: pendingnew

New jfiddle http://jsfiddle.net/jplevene/FEbxQ/2/

Drag and drop from one list to the other

Changed November 29, 2012 01:36PM UTC by tj.vantoll comment:5

Per the docs (http://api.jqueryui.com/sortable/#event-stop)

ui.sender
is only populated if the item comes from another
sortable
.

Therefore, in your example if you sort within the same list

ui.sender
will always be
null
and that is expected.

If I move a sortable item from

#sort1
to
#sort2
,
#sort1
's
stop
event has a
null
ui.sender
. This is expected as well.
#sort2
's
receive
event fires and it has a popuplated
ui.sender
.

#sort2
's
stop
event is not fired when it receives a sortable item and I believe that is expected behavior as well. Therefore I believe everything here is working as intended. scott_gonzalez?

Changed November 29, 2012 01:39PM UTC by scottgonzalez comment:6

resolution: → notabug
status: newclosed

Yes, that all sounds right. start and stop are paired, so you'd only get a stop event on the sortable that started the sort, which will not have a sender since it is the origin of the sort.

Changed November 29, 2012 04:07PM UTC by jplevene comment:7

Replying to [comment:6 scott.gonzalez]:

Yes, that all sounds right. start and stop are paired, so you'd only get a stop event on the sortable that started the sort, which will not have a sender since it is the origin of the sort.

Then there is another bug as stop is still fired when an item is dropped from another list. This also means that sender will always be null, therefore why have it there anyway?

Changed November 29, 2012 04:21PM UTC by tj.vantoll comment:8

Replying to [comment:7 jplevene]:

Replying to [comment:6 scott.gonzalez]: > Yes, that all sounds right. start and stop are paired, so you'd only get a stop event on the sortable that started the sort, which will not have a sender since it is the origin of the sort. Then there is another bug as stop is still fired when an item is dropped from another list. This also means that sender will always be null, therefore why have it there anyway?
stop
will only be fired if the sorting action originated from that
sortable
.

But I believe you are correct that

ui.sender
will always be
null
in the
stop
event. I believe it's there for consistency in case you wanted to use the same function to handle multiple sort events.