updating several divs within a controller

I would know if it's possible to do the following:

I have a head-DIV, main-Div and a navigation-DIV and a global application Layout.

I would know if it's possible to do the following:

I have a head-DIV, main-Div and a navigation-DIV and a global application Layout.

--------------------------- - head - - link1 link2 link3 - --------------------------- - - - - nav - main - - - - ---------------------------

When I click a link in the head-DIV (link_to) I load the according rhtml-File within the controller -> the main-DIV is updated showing the requested content.

How can I update the nav-DIV to present a submenu to the user? Must I call a render calling a rjs file with replace_html or is there a more recommended way to do this?

That would be the best idea IMO. I had to do the same you need and i tried some solutions, the best one to keep clean code and performance is the rjs with the replace_html.

Emilio Tagua schrieb:

I would know if it's possible to do the following:

I have a head-DIV, main-Div and a navigation-DIV and a global application Layout.

--------------------------- - head - - link1 link2 link3 - --------------------------- - - - - nav - main - - - - ---------------------------

When I click a link in the head-DIV (link_to) I load the according rhtml-File within the controller -> the main-DIV is updated showing the requested content.

How can I update the nav-DIV to present a submenu to the user? Must I call a render calling a rjs file with replace_html or is there a more recommended way to do this?

That would be the best idea IMO. I had to do the same you need and i tried some solutions, the best one to keep clean code and performance is the rjs with the replace_html.

Could you give me a code-example please?

controller:

  def index   end

template:   index.rhtml (rendered in the main-DIV)

Where must I put the rjs code that the navigation gets updated when the index.rhtml is rendered?

Thanx