Large DIV Area to Update; Seperate Data from View?


#1

What is the best way of doing this?

I have a series of links across the top of the page.

I have a large empty

layer below those links (let’s call the layer
‘X’).

The sites header and footer surround X. What I would like to do,
whenever
the user clicks on a menu link, I would like that action to be displayed
within the X div panel.

The problem is with the link_to_remote call, I can specify the X div tag
to be updated, but that means that the data being returned from the
server
will have to include the layout details along with the data.

It’d be nice to be able to say if the user clicks the “list” link, go
grab
all of the list items, and display them within the div tag X with the
list
view applied. If the user clicked the “delete” tag, return any needed
data, apply the delete view and display that within div tag X.

This way at least the header and footer are never redrawn. I could do
something like this with an inline frame but maybe there’s a better way.


#2

The problem is with the link_to_remote call, I can specify the X div tag
to be updated, but that means that the data being returned from the
server
will have to include the layout details along with the data.

Just specify :layout => false for the methods that are supposed to be
shown inside the DIV. This way they will be rendered inside your current
layout using the link_to_remote call and won’t cause double layouts to
appear.


#3

You may want to check out the new .rjs view templates:

http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates

Then you could return a partial for the list and insert it into the div
X.
The partial could contain whatever formatting for the list that you
wanted.
You’ll have to be on edge rails though.

-Tom