Hi there, i need to drag an draggable element to an child div node inside an another div container, but i create the child node dynamicly with ids like '' div_ + i '' where ''i'' is a incremental variable, thats the problem because i need get the id of this child nodes to manipulate it, somebody knows how if i drag the element to that child node i can get the id of that node ? i try with the dropon.id but i get the id of the parent div node, i need the id of the childs thanks -- // // Ing. Francisco J. Calderón S. // fjcalderon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org // Usuario de GNU/Linux nº 349529 // Maracay, Venezuela // _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
On Wed, 2006-01-11 at 12:06 -0400, Francisco Calderon wrote:> Hi there, i need to drag an draggable element to an child div node > inside an another div container, but i create the child node dynamicly > with ids like '' div_ + i '' where ''i'' is a incremental variable, thats > the problem because i need get the id of this child nodes to > manipulate it, somebody knows how if i drag the element to that child > node i can get the id of that node ? i try with the dropon.id but i > get the id of the parent div node, i need the id of the childsI did something similar, but I don''t know if this actually answers your question, but might be able to do something similar. I wanted to structure my ondrop callbacks to take both the element that was dropped and the element that was the target of the drop. Since scriptaculous requires that ondrop callbacks be passed the element being dragged as its sole argument, I ended up creating a closure containing my two argument callback, where the target element was bound. Whenever I created a new drop target, I then passed set my closure to be the callback. function init() { // ''navigation-right'' and ''navigation-left'' are the ids of the drop targets. fun = new Function("ele", "return on_navigation_item_drop_vert(ele, document.getElementById(''navigation-right''))); Droppables.add(''navigation-right'', { accept: [''navigation-item''], onDrop: fun }); fun = new Function("ele", "return on_navigation_item_drop_vert(ele, document.getElementById(''navigation-left''))); Droppables.add(''navigation-left'', { accept: [''navigation-item''], onDrop: fun }); } function on_navigation_item_drop_vert(drag_ele, droptarget_ele) { do_stuff(droptarget_ele); drag_ele.style[''display''] = ''block''; }
thanks a lot, thats gave me an idea, see ya! 2006/1/11, Jonathan Koren <jkoren-q7EdVjSQ/dO6BbymS3xAUA@public.gmane.org>:> > > I did something similar, but I don''t know if this actually answers your > question, but might be able to do something similar. > > I wanted to structure my ondrop callbacks to take both the element that > was dropped and the element that was the target of the drop. Since > scriptaculous requires that ondrop callbacks be passed the element being > dragged as its sole argument, I ended up creating a closure containing > my two argument callback, where the target element was bound. Whenever > I created a new drop target, I then passed set my closure to be the > callback. > >-- // // Ing. Francisco J. Calderón S. // fjcalderon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org // Usuario de GNU/Linux nº 349529 // Maracay, Venezuela // _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
The onDrop callback takes two arguments, the draggable, and the droppable. This is right out of the box. ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Francisco Calderon Sent: Friday, January 13, 2006 7:52 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] divider id of container thanks a lot, thats gave me an idea, see ya! 2006/1/11, Jonathan Koren <jkoren-q7EdVjSQ/dO6BbymS3xAUA@public.gmane.org>: I did something similar, but I don''t know if this actually answers your question, but might be able to do something similar. I wanted to structure my ondrop callbacks to take both the element that was dropped and the element that was the target of the drop. Since scriptaculous requires that ondrop callbacks be passed the element being dragged as its sole argument, I ended up creating a closure containing my two argument callback, where the target element was bound. Whenever I created a new drop target, I then passed set my closure to be the callback. -- // // Ing. Francisco J. Calderón S. // fjcalderon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org // Usuario de GNU/Linux nº 349529 // Maracay, Venezuela // The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs