Link to home
Start Free TrialLog in
Avatar of Mark Franz
Mark FranzFlag for United States of America

asked on

Remove Drag & Drop Item from List

In the demo page, jQuery Demo Build, I want to have the ability to remove an item from the populated list.  
Avatar of Sudaraka Wijesinghe
Sudaraka Wijesinghe
Flag of Sri Lanka image

You have to make both your containers "droppable" and add the code to handle drops.
See the example in jQuery UI demo here http://jqueryui.com/demos/droppable/#photo-manager
Avatar of Mark Franz

ASKER

Yeah, I saw that and it's almost exactly what I want, but I need to have capability to add duplicate items.  For instance, in my example page you can add one, two three or as many oranges you want as a built list.  But still have the ability to remove an item.
To be able to drop multiple of the same object, you have to drop a clone of the object to the second box, so that the original is not removed from the first box.
http://stackoverflow.com/questions/6400154/jquery-ui-drag-and-drop-using-a-draggable-more-than-once
I'm already dropping duplicate items, I just need to be able to remove a particular item, do you have time to work on the code example?  I need to be able to use pictures to build a list.

My basic requirements;

1) Drag an image to an "overflow:auto" div  [done]
2) Allow the images to be moved around  [done]
3) Allow the removing of a particular image
4) Save the built image in the exact order placed for later processing  [in work]
ASKER CERTIFIED SOLUTION
Avatar of Sudaraka Wijesinghe
Sudaraka Wijesinghe
Flag of Sri Lanka image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You the man!  Quick and simple, I even learned something...  ;-)

      $('.shop-container').droppable({
                  accept: '#sortable li',
                  drop: function(event, ui) {
                        ui.draggable.remove();
                  }
            });
Glad to help. Thanks for the points.
Before I submit another question, do you know the easiest way to process the built list for submit to a form page?  
You can add a hidden INPUT element to each LI of the list, so when you submit you get the selected list.
Good idea!