Forum: Ruby on Rails RJS Queue

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Brandon S. (Guest)
on 2006-04-03 19:40
Hi,

I've been able to succesfully queue page.visual_effect commands in my
RJS templates.  Each command will wait to execute until the previous
command is done executing.

But I'd also like to execute a page.replace_html command AFTER the
page.visual_effect commands.  I have a series of five DIVs:

div1
div2
div3
div4
div5

When the user clicks on div1, a page.visual_effect command is executed
in div1 disappears.  At this point, I want to execute a
page.replace_html command on my divs.  Right now, the visual_effect and
replace_html execute in parallel, so you never see the visual_effect
take place.

Can anyone help me with this?

Thanks in advance!

Brandon
Charlie Bowman (Guest)
on 2006-04-03 19:46
(Received via mailing list)
I hope I'm wrong, but I don't think that can be done without writing
your own javascript. I've asked the same question multiple times but no
answer.  Could you post your queued visual effects code.  I haven't
tried to do that with rjs yet.
Brandon S. (Guest)
on 2006-04-03 19:57
Charlie,

Check out this page for details:

http://www.railsdevelopment.com/2006/01/15/effectqueue/

All I had to do was add the :queue => 'end' parameter to the end of my
visual_effect commands.  I hope this helps.

Brandon
8eced1196403e6f55e1baee606a7f6e4?d=identicon&s=25 Sergei S. (sserdyuk)
on 2006-04-03 20:08
Hi Brandon,

Effects have events you can use to syncronize your other code with them.

For example:

new Effect.BlindDown('customer_edit', {
afterFinish: function(element){alert('You can see it now');}
});

Event names are beforeStart, beforeSetup, beforeUpdate, beforeFinish and
their 'after' mates.

Enjoy.
Charlie Bowman (Guest)
on 2006-04-03 20:26
(Received via mailing list)
Thank you! I've been trying to figure out how to do this but to no
avail!
Brandon S. (Guest)
on 2006-04-03 20:30
Thanks Sergei.  I'll try it out.
This topic is locked and can not be replied to.