i know someone just recently asked about queueing ajax requests, my question is similar in the regards that i don''t want my application to send multiple requests. i have 2 sortabbles lists left, and right. when i move an item from left to the right the onUpdate callback will send 2 ajax requests. one for each sortables. however. i want it to serialize and send back the results from both lists once.not once each. lets pretend that my draggable elements in the droppable "left" are 1,2,3 and that the draggables in droppable "right" are 4,5,6 well as it is now, when i drag "left 1" to the bottom of "right" i''d have this serialized left[]=2&left=3 right[]=4&right[]=5&right[]=6&right[]=1 thats because the onUpdate is called for each sortable. now. is there a way to make it so that the onUpdate is called once but include the information for both droppables, so that in my serialize i''d get this... left[]=2&left=3&right[]=4&right[]=5&right[]=6&right[]=1 i was thinking if i set up a JS variable that i can set to equal both, then send the data like this var foo=Sortable.serialize(''left'')+"&"+Sortable.serialize(''right''); new Ajax.Request(''some_url'', {method:''post'', postBody:foo});"; foo=""; how would i do something like that? i need to post both serialized lists to a database in the same field, and it''s not efficent to send half the data twice and do an update on the field. any ideas on how i''d accomplish this task? thanks -Jaimz
Hi, everyone: I am starting with doing draggables, etc. I am looking at the droptest_5 example. How do I get back the final position of the dragged element in coordinates? Deco
This page will give you the position of the mouse when the element is dropped. <html> <head> <title>script.aculo.us Drag and drop functional test file</title> <script src="../../lib/prototype.js" type="text/javascript"></script> <script src="../../src/scriptaculous.js" type="text/javascript"></script> <script src="../../src/unittest.js" type="text/javascript"></script> </head> <style> div.hoverclass123 { border:1px solid red; } </style> <body> <h1>script.aculo.us Drag and drop functional test file</h1> <h2>w/o hoverclass</h2> <div id="cart" class="cart" style="text-align:center;height:50px;padding:10px;background-color:#fba"> <span>### DROP HERE ###</span> </div> <script type="text/javascript">Droppables.add(''cart'', {onDrop:function(element,dropon,event){alert(''w/o hoverclass, should be \''product_id\'':'' + encodeURIComponent( element.id) + '', dropon should be \''cart\'':'' + dropon.id);alert(Event.pointerX(event)+", "+Event.pointerY(event));}})</script> <br/> <img alt="Product2" id="product_id" src="icon.png" /> <span><-- drag this!</span> <script type="text/javascript">new Draggable(''product_id'', {revert:true})</script> </body> </html> On 1/11/06, Deco Rior <decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote:> Hi, everyone: > > I am starting with doing draggables, etc. > > I am looking at the droptest_5 example. > > How do I get back the final position of the dragged element in > coordinates? > > Deco > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >-- ===========================Brian Peiris Brampton, Ontario, Canada brianpeiris-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or brianpeiris-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org =========================== _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thanks, I am getting better at this! Is there a simple way to get the position within the element that was clicked? Deco On Jan 11, 2006, at 12:25 AM, Brian Peiris wrote:> This page will give you the position of the mouse when the element > is dropped. > > <html> > <head> > <title>script.aculo.us Drag and drop functional test file</ > title> > <script src="../../lib/prototype.js" type="text/ > javascript"></script> > <script src="../../src/scriptaculous.js" type="text/ > javascript"></script> > <script src="../../src/unittest.js" type="text/ > javascript"></script> > </head> > <style> > div.hoverclass123 { > border:1px solid red; > } > </style> > <body> > > <h1>script.aculo.us Drag and drop functional test file</h1> > > <h2>w/o hoverclass</h2> > > <div id="cart" class="cart" style="text-align:center;height: > 50px;padding:10px;background-color:#fba"> > <span>### DROP HERE ###</span> > </div> > > <script type="text/javascript">Droppables.add(''cart'', > {onDrop:function(element,dropon,event){alert(''w/o hoverclass, > should be \''product_id\'':'' + encodeURIComponent( element.id) + '', > dropon should be \''cart\'':'' + dropon.id);alert(Event.pointerX(event) > +", "+Event.pointerY(event));}})</script> > > <br/> > > <img alt="Product2" id="product_id" src="icon.png" /> > <span><-- drag this!</span> > > <script type="text/javascript">new Draggable(''product_id'', > {revert:true})</script> > > </body> > </html> > > On 1/11/06, Deco Rior <decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote: > > Hi, everyone: > > > > I am starting with doing draggables, etc. > > > > I am looking at the droptest_5 example. > > > > How do I get back the final position of the dragged element in > > coordinates? > > > > Deco > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > -- > ===========================> Brian Peiris > Brampton, Ontario, Canada > brianpeiris-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or brianpeiris-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > ===========================> _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs