Opened 15 years ago
Last modified 9 years ago
#4303 open bug
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 (20)
Changed 15 years ago by
Attachment: | sortable.receive-callback.ui.html added |
---|
comment:2 Changed 15 years ago by
Component: | ui.core → ui.sortable |
---|
comment:3 Changed 15 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
This is as designed. The property you want is ui.helper.
comment:4 Changed 15 years ago by
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.
comment:5 Changed 15 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:6 Changed 15 years ago by
Milestone: | TBD → 1.8 |
---|---|
Owner: | set to rdworth |
Status: | reopened → assigned |
Changed 14 years ago by
Attachment: | sortable-item-sender.patch added |
---|
Make sure item is the item being added and sender is still the sender
comment:7 follow-up: 11 Changed 14 years ago by
This makes it work for me, no guarantees tough. The patch is against 1.7.2 ..
comment:8 Changed 14 years ago by
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.
comment:9 Changed 13 years ago by
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.
comment:10 Changed 13 years ago by
Priority: | critical → major |
---|
comment:11 Changed 13 years ago by
Replying to asannes:
This makes it work for me, no guarantees tough. The patch is against 1.7.2
..
Where can I find this patch?
comment:12 Changed 12 years ago by
I also applied this patch in order to be able to modify the dropped element in the sortreceive callback. Works with 1.8.18.
comment:13 Changed 11 years ago by
Milestone: | 1.9.0 → 2.0.0 |
---|
comment:14 Changed 11 years ago by
Owner: | rdworth deleted |
---|---|
Status: | assigned → open |
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.
comment:15 Changed 11 years ago by
Keywords: | haspatch added |
---|
comment:16 Changed 11 years ago by
The following test case shows this http://jsfiddle.net/tj_vantoll/5fJ6q/.
Testcase