# Updating a tr with RJS

**URL:** <https://www.ruby-forum.com/t/updating-a-tr-with-rjs/101918>\
**Category:** Rails\
**Created:** [August 8, 2006, 6:21pm UTC](https://www.ruby-forum.com/t/updating-a-tr-with-rjs/101918 "2006-08-08T18:21:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [August 8, 2006, 6:21pm UTC](https://www.ruby-forum.com/t/updating-a-tr-with-rjs/101918/1 "2006-08-08T18:21:30Z")

</div>

I’m having a strange display issue when trying to update a tablerow  
using RJS.

This is the code in the RJS template:

page.replace\_html “item\_#{@item.id}”, :partial =\> ‘item\_display’

So the existing

 has an id like item\_1. When the update actions  
completes, it renders this template and effectively replaces the tr with  
item\_display which as a tr of its own. The issue is, the new row doesn’t  
span the width of the table.

Has anyone encountered this before?

Thanks.

---

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [August 8, 2006, 6:23pm UTC](https://www.ruby-forum.com/t/updating-a-tr-with-rjs/101918/2 "2006-08-08T18:23:40Z")

</div>

Most/all browsers don’t have any support for DOM manipulation of tables.  
Not sure why, its a real pity. You’ll need to come up with a hack for  
it. I think the [ajaxscaffold.com](http://ajaxscaffold.com) solution includes some code that works  
with table dom manipulation.

---

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [August 8, 2006, 8:54pm UTC](https://www.ruby-forum.com/t/updating-a-tr-with-rjs/101918/3 "2006-08-08T20:54:28Z")

</div>

Make sure you enclose your TRs in a TBODY tag.

Zack

---

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [August 8, 2006, 9:56pm UTC](https://www.ruby-forum.com/t/updating-a-tr-with-rjs/101918/4 "2006-08-08T21:56:48Z")

</div>

Zack,

That does help for not getting the IE error, but still when updating a  
row by replacing it with a partial, doesn’t render it correctly.

Thanks.

Zack C. wrote:

> Make sure you enclose your TRs in a TBODY tag.
> 
> Zack
