Hi all, I''m trying to create a recycle bin for elements from a Sortable. To do that I created an <img> (image of a recycle-bin ofcourse) and made it a Droppable. However what should I do with the element in the onDrop function of the Droppable to stop it from going back into the Sortable? How do I remove it altogether from the page? thanks and regards, Jeroen
Hi, for an project of mine I also needed an trash. I solved this with using an <ul> as the trash and made it also an sortable and set the "containment" property for the sortables. With this it is possible to drag my items to the trash and if done so, the "onUpdate" function sets the "display" property to none. Greets, Tim
Hi Tim, On 8/3/06, Tim Bellinghausen <tim-YhifRh7pDeDL13VPICy1DA@public.gmane.org> wrote:> > for an project of mine I also needed an trash. I solved this with using > an <ul> as the trash and made it also an sortable and set the > "containment" property for the sortables. With this it is possible to > drag my items to the trash and if done so, the "onUpdate" function sets > the "display" property to none.This would work, but the items that I want to delete also contain textarea, so form elements that I do not want to be submitted. So somehow i have to completely removed those elements from the DOM. Thanks, Jeroen
Tim Bellinghausen wrote:> Hi, > > for an project of mine I also needed an trash. I solved this with using > an <ul> as the trash and made it also an sortable and set the > "containment" property for the sortables. With this it is possible to > drag my items to the trash and if done so, the "onUpdate" function sets > the "display" property to none.What I''ve done in the past is to make the trash can a Droppable, and then in the onDrop callback, hide the draggable being dropped, as well as call it''s destroy() method. -- Michael Peters Developer Plus Three, LP
> This would work, but the items that I want to delete also contain > textarea, so form elements that I do not want to be submitted. So > somehow i have to completely removed those elements from the DOM.Make the droppable be outside the form element, it will not get submitted then. Greg
Add a DISABLED attribute to the form element and it will not be submitted. -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jeroen Verhagen Sent: Thursday, August 03, 2006 12:10 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] creating a recycle-bin Hi Tim, On 8/3/06, Tim Bellinghausen <tim-YhifRh7pDeDL13VPICy1DA@public.gmane.org> wrote:> > for an project of mine I also needed an trash. I solved this with using > an <ul> as the trash and made it also an sortable and set the > "containment" property for the sortables. With this it is possible to > drag my items to the trash and if done so, the "onUpdate" function sets > the "display" property to none.This would work, but the items that I want to delete also contain textarea, so form elements that I do not want to be submitted. So somehow i have to completely removed those elements from the DOM. Thanks, Jeroen _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thanks for all your reactions On 8/4/06, louis d walch <dev-bTJQVtzvk6sqDJ6do+/SaQ@public.gmane.org> wrote:> Add a DISABLED attribute to the form element and it will not be submitted.The solution that worked was either: element.innerHTML = ''''; or: element.parentNode.removeChild(element); is guess setting the ''disabled'' would also work but then I would have to get a handle to the textarea in the element first. I also tried Sortable.destroy(element) but that didn''t do anything. I wonder if I''m using the destroy method correctly like this. Thanks and regards, Jeroen