-
Notifications
You must be signed in to change notification settings - Fork 441
canceling drag between connected lists drops item #107
Comments
You should use the model to count the length of the list, not the DOM elements. |
Fair enough. The same problem will persist, however. Canceling the sort will replace the item in the proper place in the DOM, but it will not replace the model. That just gets lost. New codepen with model checking: http://codepen.io/anon/pen/fAvCJ |
Here is the order that the events fire on connected lists:
As far as I know the best time to call Feel free to reopen if necessary. |
Works great. Thanks! |
How would I go about cancelling a drag between lists, but allowing ordering within a list, only for certain elements (validation)? When I try to cancel when |
You can place your logic in the update callback and use the properties of
|
I tried doing that, but I need to know if it's just a sort within the list, or moving to a second list. There is no indication of this until either the second |
As noted in API.md, you can use the |
The comparison of |
I'm sorry, maybe I'm dense, but I feel like you didn't read my last comment very closely. The problem I'm having is with the timing of the cancellation. If I cancel after I know if it's a reorder or a move, then the source list has already been updated, and cancelling producing the situation mentioned by the PO above, wherein the draggable is neither here nor there - it appears to be in the list, but it's missing from the |
Please provide an example of your use case by forking one of the codepen
|
Thank you so much for your assistance. Examining the 'promised cancellation' example I was able to come up with a satisfactory workaround. I'm posting my code in case it might be of help to someone else in the future:
Essentially, what's happening here is that in the first list, where I want to keep items that don't pass validation but allow them to be reordered within it, I perform validation on every update. If the item doesn't pass validation, I store it in the |
I'm trying to cancel dragging an item from one list to another if certain conditions are met (in the example, max list size).
http://codepen.io/anon/pen/toDej
Try to have more than 10 things in one of the lists. Visually, there are no problems, but if you log out the results, you see items are getting removed from one list and not put back. It could be that I'm approaching this wrong, but I'm running out of ideas.
Oh, and I am using the angular1.2 branch.
The text was updated successfully, but these errors were encountered: