Thursday, March 10, 2011

[Rails] 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",
"table_analyses"]
render :update do |page|
@tables.each do |table|
page.insert_html :bottom, 'table_list', "<li
id='#{table}'>#{table}</li>"
page.visual_effect :highlight, "#{table}"
sleep 3
end
end
end

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 :

<ul>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


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate