JQuery - Ajax saving sortables in connected lists when sortable item is moved

Posted by Ben Sinclair on Stack Overflow See other posts from Stack Overflow or by Ben Sinclair
Published on 2010-05-14T01:57:29Z Indexed on 2010/05/14 2:04 UTC
Read the original article Hit count: 381

Filed under:
|
|

I have multiple JQuery sortable lists that connect with each other... They allow you to assign users to certain roles.

Basically what I want to do is when a user is dragged from one list to another, I want JQuery to pick up the first list that the user was moved from so that I can send an AJAX request to delete it from that list in my database.

I tried the following but every time you move the user over a list and haven't even dropped it within a list, it sends this request which means I'll be sending multiple AJAX requests... Does that make sense?

$( ".selector" ).sortable({
   out: function(event, ui) { ... }
});

From my testing, I can use the following code to just update the list that user has been moved to so I've got the second half covered:

$( ".selector" ).sortable({
   receive: function(event, ui) { ... }
});

Hopefully I am making sense :)

© Stack Overflow or respective owner

Related posts about jquery-sortable

Related posts about jQuery