Search and Top Navigation
#9756 closed feature (wontfix)
Opened January 20, 2014 08:47PM UTC
Closed May 20, 2014 02:48PM UTC
Sortable: Allow calling refresh during drag
Reported by: | NiGhTTraX | Owned by: | NiGhTTraX |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.sortable | Version: | 1.10.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If you remove an item from a sortable while sorting and then call the
refreshmethod it will cause the
changeevent to fire at every mouse drag.
See this http://jsfiddle.net/NiGhTTraX/6mdZN/ for more details. When you start sorting the list, or drag a draggable over, the
sortoverevent will fire. In the event function, I remove the last element in the list and call
refresh. Notice that the
changeevent is logged in the console on every mouse drag.
The problem seems to be in the
_mouseDragfunction. More specifically, the event is triggered at line 406.
Attachments (0)
Change History (7)
Changed January 20, 2014 09:41PM UTC by comment:1
owner: | → NiGhTTraX |
---|---|
status: | new → pending |
Changed January 21, 2014 05:15AM UTC by comment:2
status: | pending → new |
---|
Use case: I'm building a sortable with a max size. When the list gets full and you drag a new item, the last existing item is removed.
The workaround would be to hide the item and remove it on
sortstop, but I thought this behaviour deserved an issue so the
refreshmethod could be looked into.
Changed January 21, 2014 03:26PM UTC by comment:3
Removing an item when the user starts dragging seems odd and potentially disorienting to the user. I'll wait for the opinion of someone else on the team though.
Changed May 20, 2014 02:16AM UTC by comment:4
I agree with TJ, removing the item when the user drags and item is a very bad user experience. By using the over event it doesn't care if the item is new or not, you could be dragging an item that is already in the list and just resorting them, in your demo this is a problem, just try to drag number 3. Seems like what you really should do is be using the 'receive' event.
Changed May 20, 2014 08:49AM UTC by comment:5
I've implemented a logic to tell if the item is new or not but I didn't include it in the demo to not over-complicate it. Assuming that, my primary use case is to delete an item from the destination sortable to make room for an incoming item.
Changed May 20, 2014 08:58AM UTC by comment:6
And the receive
event is triggered when you drop a new item. I need to make room for it as soon as it's over the list.
Changed May 20, 2014 02:48PM UTC by comment:7
resolution: | → wontfix |
---|---|
status: | new → closed |
summary: | Removing an item and calling refresh during drag causes weird event behavior → Sortable: Allow calling refresh during drag |
type: | bug → feature |
This is more of a feature request than a bug, because refresh was never intended to be called during a drag, at least that I'm aware of. Since this has not been requested before, I'm going to close this ticket for now. If others desire this functionality, please add a comment to this ticket and we can consider it for the rewrite.
Do you have a practical use case for this behavior? Removing an item from the list on hover seems like bad UX.