Trying to loop a render update page

I trying to update multi times a page from inside a loop, obviously
the loop cannot be outside the update block

as a test I wrote :

def reloading
@tables = [“table_lockers”, “table_instructors”, “table_members”,
render :update do |page|
@tables.each do |table|
page.insert_html :bottom, ‘table_list’, “#{table}”
page.visual_effect :highlight, “#{table}”
sleep 3

upon click on a start link remote Ajax call to the reloading action,
this intend
to insert the names of the tables one by one into a list area on the
displayed page… with 3 sec between each insertion :

    table_list table_lockers table_instructors table_members table_analyses

    this doesn’t work as expected as the render id performed at the end of
    the loop… not in between

On Mar 10, 2011, at 8:18 AM, Erwin wrote:

      page.insert_html :bottom, 'table_list', "<li

displayed page… with 3 sec between each insertion :

This isn’t going to work if you do it in Ruby. That’s one request,
which equals one render and one flush to the browser. You’re going to
have to refactor this so that the timer is in the JavaScript, and each
request is for the next table. You’ll have to work out some sort of
semaphore between the ruby code (which knows how many of these things
to do) and the JavaScript, which does not. One way would be to have
the ruby code write an inline JavaScript block into the table code
when it knows there are more to come, and omit it if not.


Thanks …

I am looking at the

this is quite obvious ( because it’s async…) … only the client
page can request periodic updates …