Link_to_remote to update multiple components


#1

How would go about to update multiple components when using
link_to_remote?

I’ve got a button that lets you switch between languages and it has to
update every component in my application (like, let’s say: the main
screen, the top navigation bar and the search bar). Each component is
created in a different DIV and whenever the language is switched, the
entire application should reflect the change.

Using update_element_function is pretty much out of the equation because
I can’t specify a controller/action for content (instead of ugh just
plain html). Same goes for using rjs.


#2

for something like that you should not be using submit_to_remote. It’s
going
to be much easier to just use a normal submit and post-back and do a
redirect_to that will refresh the entire app.


#3

Using rjs is easier to update multiple dom response to each ajax
request.you can do sth like this:

render :update do |page|
  dom_partials_map.each do |domdiv,partialtemplate|
    page.replace_html domdiv, :partial=>partialtemplate
  end
end

Heist wrote:

How would go about to update multiple components when using
link_to_remote?