Mark Franz
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.
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
http://stackoverflow.com/questions/6400154/jquery-ui-drag-and-drop-using-a-draggable-more-than-once
ASKER
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]
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You the man! Quick and simple, I even learned something... ;-)
$('.shop-container').dropp able({
accept: '#sortable li',
drop: function(event, ui) {
ui.draggable.remove();
}
});
$('.shop-container').dropp
accept: '#sortable li',
drop: function(event, ui) {
ui.draggable.remove();
}
});
Glad to help. Thanks for the points.
ASKER
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.
ASKER
Good idea!
See the example in jQuery UI demo here http://jqueryui.com/demos/droppable/#photo-manager