Hi everybody- First time poster, please be gentle. I have written a little rails app where you can create divs and move them around via Thomas'' wonderful dragdrop.js. I would like to be able to fire an AJAX event to update the top and left of the dragged object upon release. I see many AJAX link_to_remote and observe_field. What is the proper way to observe that the position (not content) of a div has changed? I can think of 2 manners, but both seem antiquated compared to the techniques here: 1. put a hidden field inside the div with the top+left, updating these values upon Draggable.finishDrag, triggering an AJAX event 2. Put a whole call to AJAX.Updater inside of a new method of Draggable, called when finishDrag is nearly done. Maybe that''s really 1 manner. In any event, is there a way to extend the Draggable object without modifying dragdrop.js? Can you add more methods via Draggable.prototype? Alternately, if anyone knows of a means to trigger an AJAX event in response to a purely DHTML-type event, please offer a suggestion. thanks, Jason
Override endeffect of the draggable when you create it... new Draggable(element, {endeffect: yourFunction}); -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jason Kunesh Sent: Friday, February 03, 2006 5:06 PM To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] overloading dragdrop.js Hi everybody- First time poster, please be gentle. I have written a little rails app where you can create divs and move them around via Thomas'' wonderful dragdrop.js. I would like to be able to fire an AJAX event to update the top and left of the dragged object upon release. I see many AJAX link_to_remote and observe_field. What is the proper way to observe that the position (not content) of a div has changed? I can think of 2 manners, but both seem antiquated compared to the techniques here: 1. put a hidden field inside the div with the top+left, updating these values upon Draggable.finishDrag, triggering an AJAX event 2. Put a whole call to AJAX.Updater inside of a new method of Draggable, called when finishDrag is nearly done. Maybe that''s really 1 manner. In any event, is there a way to extend the Draggable object without modifying dragdrop.js? Can you add more methods via Draggable.prototype? Alternately, if anyone knows of a means to trigger an AJAX event in response to a purely DHTML-type event, please offer a suggestion. thanks, Jason _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs 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.
Thanks, Ryan. I''ve learned more about .js with script.aculo.us and Rails from reading this mailing list than anything. Thanks again! --- Ryan Gahl <Ryan.Gahl-nlycWCgr5/vuufBYgWm87A@public.gmane.org> wrote:> Override endeffect of the draggable when you create > it... > > new Draggable(element, {endeffect: yourFunction}); > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]> On Behalf Of Jason > Kunesh > Sent: Friday, February 03, 2006 5:06 PM > To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] overloading dragdrop.js > > Hi everybody- > > First time poster, please be gentle. > > I have written a little rails app where you can > create > divs and move them around via Thomas'' wonderful > dragdrop.js. I would like to be able to fire an AJAX > event to update the top and left of the dragged > object > upon release. I see many AJAX link_to_remote and > observe_field. > > What is the proper way to observe that the position > (not content) of a div has changed? > > I can think of 2 manners, but both seem antiquated > compared to the techniques here: > > 1. put a hidden field inside the div with the > top+left, updating these values upon > Draggable.finishDrag, triggering an AJAX event > > 2. Put a whole call to AJAX.Updater inside of a new > method of Draggable, called when finishDrag is > nearly > done. > > Maybe that''s really 1 manner. In any event, is there > a > way to extend the Draggable object without modifying > dragdrop.js? Can you add more methods via > Draggable.prototype? > > Alternately, if anyone knows of a means to trigger > an > AJAX event in response to a purely DHTML-type event, > please offer a suggestion. > > thanks, > > Jason > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs> > 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. > >
You''re welcome! I''ve never seen a lick of Ruby, other than Why''s Poignant Guide (love the cartoon foxes). I''m using proto and scriptaculous in a .NET environment. Goes to show you how versatile these scripts are. -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jason Kunesh Sent: Friday, February 03, 2006 5:13 PM To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] overloading dragdrop.js Thanks, Ryan. I''ve learned more about .js with script.aculo.us and Rails from reading this mailing list than anything. Thanks again! --- Ryan Gahl <Ryan.Gahl-nlycWCgr5/vuufBYgWm87A@public.gmane.org> wrote:> Override endeffect of the draggable when you create > it... > > new Draggable(element, {endeffect: yourFunction}); > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]> On Behalf Of Jason > Kunesh > Sent: Friday, February 03, 2006 5:06 PM > To: Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] overloading dragdrop.js > > Hi everybody- > > First time poster, please be gentle. > > I have written a little rails app where you can > create > divs and move them around via Thomas'' wonderful > dragdrop.js. I would like to be able to fire an AJAX > event to update the top and left of the dragged > object > upon release. I see many AJAX link_to_remote and > observe_field. > > What is the proper way to observe that the position > (not content) of a div has changed? > > I can think of 2 manners, but both seem antiquated > compared to the techniques here: > > 1. put a hidden field inside the div with the > top+left, updating these values upon > Draggable.finishDrag, triggering an AJAX event > > 2. Put a whole call to AJAX.Updater inside of a new > method of Draggable, called when finishDrag is > nearly > done. > > Maybe that''s really 1 manner. In any event, is there > a > way to extend the Draggable object without modifying > dragdrop.js? Can you add more methods via > Draggable.prototype? > > Alternately, if anyone knows of a means to trigger > an > AJAX event in response to a purely DHTML-type event, > please offer a suggestion. > > thanks, > > Jason > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs> > 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