Am Sonntag, 30. April 2006 22:19 schrieb Grzesiek Slusarek:
> Hi all. I have got situation that I made element draggable - and
> when element is dragged I want to start some action (e.g. shown
> AJAX indicator, and change one of CSS class in dragging element).
> What is the best way to achieve this? I search source code of the
> Draggable and I saw that there is 2 method: Draggable.initDrag
> and Draggable.endDrag so it looks like in initDrag method i
> should call my own function which do the fing and in endDrag
> method I should call my own function which cancel behaviour of
> preview function. Is it better way to do it?

Hello,

for the draggables i use starteffect and endeffect (basically that's 
onDragStart and onDragEnd in other frameworks). You can overwrite the methods 
when you create the object. The Wiki lacks a code example, but it works the 
same way as in the Droppable example.  
http://wiki.script.aculo.us/scriptaculous/show/Droppables.add

However, as for the AJAX indicator there is a built-in mechnism called 
Ajax.Responders. It's some kind of global AJAX activity monitor. Excellent 
stuff. :)
Here's an example, i'm sure you get the idea:
//-------------------------------------
  Ajax.Responders.register({
    onCreate: function() {
      if(Ajax.activeRequestCount > 0)
        Element.show(id);
    },
    onComplete: function() {
      if(Ajax.activeRequestCount == 0)
        Element.hide(id);
    }
  });
//-------------------------------------

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to