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 childs

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.


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';
}

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to