Opened 9 years ago
Closed 9 years ago
#9756 closed feature (wontfix)
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 refresh
method it will cause the change
event 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 sortover
event will fire. In the event function, I remove the last element in the list and call refresh
. Notice that the change
event is logged in the console on every mouse drag.
The problem seems to be in the _mouseDrag
function. More specifically, the event is triggered at line 406.
Change History (7)
comment:1 Changed 9 years ago by
Owner: | set to NiGhTTraX |
---|---|
Status: | new → pending |
comment:2 Changed 9 years ago by
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 refresh
method could be looked into.
comment:3 Changed 9 years ago by
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.
comment:4 Changed 9 years ago by
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.
comment:5 Changed 9 years ago by
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.
comment:6 Changed 9 years ago by
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.
comment:7 Changed 9 years ago by
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.