Skip to main content

Search and Top Navigation

#4303 open bug ()

Opened March 09, 2009 10:07AM UTC

Last modified February 26, 2015 10:34PM UTC

sortable: receive: ui.item references the source element

Reported by: Marc Diethelm Owned by:
Priority: major Milestone: 2.0.0
Component: ui.sortable Version: 1.7
Keywords: haspatch Cc:
Blocked by: Blocking:
Description

I used to be able to manipulate/replace a dropped element (dragged from a draggable with helper: "clone") in the sortable's receive handler using ui.item. But now ui.item references the source element.

Attachments (2)
Change History (18)

Changed March 09, 2009 10:43AM UTC by Marc Diethelm comment:1

forgot to set the component...

Changed March 18, 2009 10:38AM UTC by rdworth comment:2

component: ui.coreui.sortable

Changed March 18, 2009 12:57PM UTC by rdworth comment:3

resolution: → invalid
status: newclosed

This is as designed. The property you want is ui.helper.

Changed March 25, 2009 07:15PM UTC by codeofficer comment:4

Altering ui.helper seems to have no effect for me. And I'm not sure I understand why ui.item and ui.sender both refer to the same element now. ui.item used to refer to the dropped element.

Something changed in 1.7, my old code was working fine in 1.6. Its not clear to me what the workaround should be to alter the contents of a dropped element in a sortable's receive callback.

Changed March 26, 2009 05:08PM UTC by rdworth comment:5

resolution: invalid
status: closedreopened

Changed March 26, 2009 05:08PM UTC by rdworth comment:6

milestone: TBD1.8
owner: → rdworth
status: reopenedassigned

Changed August 05, 2009 07:35AM UTC by asannes comment:7

This makes it work for me, no guarantees tough.

The patch is against 1.7.2 ..

Changed November 05, 2009 10:19PM UTC by rubyjedi comment:8

Thank you! sortable-item-sender.patch is exactly what I need. Similar use case - I alter ui.item with html() or replaceWith() in the receive handler.

Without the patch, there's no easy way to alter the item before it's inserted to the Sortable, as ui.helper is a throw-away clone, and ui.sender (in my use case) is merely a thumbnail image. Unpatched seems to always clone ui.sender.

Changed October 01, 2010 06:15AM UTC by aheywood comment:9

Thanks for the patch, I had to use this on v1.8 to get it working, otherwise there is no easy way to manipulate the dropped item.

Changed October 19, 2010 03:52PM UTC by scottgonzalez comment:10

priority: criticalmajor

Changed January 18, 2011 04:13PM UTC by tobymackenzie comment:11

Replying to [comment:7 asannes]:

This makes it work for me, no guarantees tough. The patch is against 1.7.2

..

Where can I find this patch?

Changed February 24, 2012 01:47PM UTC by micha-f comment:12

I also applied this patch in order to be able to modify the dropped element in the sortreceive callback. Works with 1.8.18.

Changed October 11, 2012 02:54PM UTC by scottgonzalez comment:13

milestone: 1.9.02.0.0

Changed October 19, 2012 05:49PM UTC by mikesherov comment:14

owner: rdworth
status: assignedopen

This is still valid. And the attached patch works. The lines have moved, but they're here now:

https://github.com/jquery/jquery-ui/blob/bae06d2b1ef6bbc946dce9fae91f68cc41abccda/ui/jquery.ui.sortable.js#L1018

https://github.com/jquery/jquery-ui/blob/bae06d2b1ef6bbc946dce9fae91f68cc41abccda/ui/jquery.ui.sortable.js#L1090

I'm taking this off of Richard as he hasn't touched this ticket in 4 years.

Changed October 19, 2012 05:51PM UTC by mikesherov comment:15

keywords: → haspatch

Changed February 28, 2013 02:44AM UTC by tj.vantoll comment:16

The following test case shows this http://jsfiddle.net/tj_vantoll/5fJ6q/.

Changed February 28, 2013 01:21PM UTC by tj.vantoll comment:17

#4253 is a duplicate of this ticket.

Changed February 26, 2015 10:34PM UTC by tj.vantoll comment:18

#11227 is a duplicate of this ticket.