Sequential "page." commands in a js.rjs file?


#1

After the (remote) delete action for my lesson_categories controller i
fall through to this js.rjs file:

page.visual_effect :fade, “lesson_category_#{@lesson_category.id}”,
:duration => 1
page.remove “lesson_category_#{@lesson_category.id}”

The problem, though, is that the visual effect is initiated, then the
remove is initiated, before the visual effect is finished, so that the
visual effect doesn’t get a chance to be seen. Is there a way to set
this up so that the remove isn’t called until the visual effect
finishes? Normally i’d look for a callback but i can’t work out how to
do it.

thanks
max


#2

On 15 Jan 2009, at 14:27, Max W. wrote:

visual effect doesn’t get a chance to be seen. Is there a way to set
this up so that the remove isn’t called until the visual effect
finishes? Normally i’d look for a callback but i can’t work out how
to
do it.

scriptaculous effects can have a bunch of options, including
afterFinish, but I think you’ll need to write the javascript out by
hand to use those.#

Fred