On some further research I noticed that, instead of adding the observer to every element, you could simply do the following:
Draggables.addObserver(new MyStartEndObserver($('MySortable')))
Handlers will be called only once, but this gives you no information on which element is dragged.
If you need that information you could change the handlers in the following way:
--------------------------------------------------------------------------------------
....
onStart: function() {
if (Draggables.activeDraggable.element == this.element)
{
alert('Let\'s go! (' + this.element.id + ')');
}
},
....
----------------------------------------------------------------------------------
Vassilis
On 8/14/06,
Tim Bellinghausen <[EMAIL PROTECTED]> wrote:
Hi,
On 08/14/2006, Vasilis Dourdounis wrote:
> I'm not sure though the following is the best way to solve it, but
> does exactly what you describe.
yes, your solution gives me the information I need, but now I am
wondering why the onStart and onStop handlers get called for every item
of the sortable and not just the one being dragged. That is no big
problem for me, but since this Observer seems to have a small, but
visible, performance drawback, I would be happy, if anyone can explain
why this happen or better give me a hint how to change this behaviour.
I will do some more testing on Wednesday since tomorrow is a public
holiday in Luxembourg.
Thanks for your help,
Tim
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________ Rails-spinoffs mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
