# Large DIV Area to Update; Seperate Data from View?

**URL:** <https://www.ruby-forum.com/t/large-div-area-to-update-seperate-data-from-view/49185>\
**Category:** Rails\
**Created:** [December 1, 2005, 12:40am UTC](https://www.ruby-forum.com/t/large-div-area-to-update-seperate-data-from-view/49185 "2005-12-01T00:40:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jjones](https://www.ruby-forum.com/u/jjones)\
**Post date:** [December 1, 2005, 12:40am UTC](https://www.ruby-forum.com/t/large-div-area-to-update-seperate-data-from-view/49185/1 "2005-12-01T00:40:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jjones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jjones](https://www.ruby-forum.com/u/jjones)\
**Post date:** [December 1, 2005, 11:04am UTC](https://www.ruby-forum.com/t/large-div-area-to-update-seperate-data-from-view/49185/2 "2005-12-01T11:04:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jjones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jjones](https://www.ruby-forum.com/u/jjones)\
**Post date:** [December 1, 2005, 2:43pm UTC](https://www.ruby-forum.com/t/large-div-area-to-update-seperate-data-from-view/49185/3 "2005-12-01T14:43:16Z")

</div>

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

[http://www.codyfauser.com/articles/2005/11/20/rails-rjs-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
