Hi - trying to update a table with page.replace_html using a partial:
The view (index.html.erb):
[code=]<div id=''prod_table''>
<%= render :partial => ''product'' %>
</div>[/code]
The partial (_product.html.erb)
[code=]<table>
<% for product in @products %>
<tr>
<td><%= product.name %></td>
<td><%= product.vendor.name %></td>
</tr>
<% end %>
</table>[/code]
The actual update:
[code=]render :update do |page|
page.replace_html ''prod_table'', :partial =>
''product''
end[/code]
I''m getting most of the page back, but the table is messed up, showing
with a lot of \n\n characters (the javascript just shows up on the
screen):
try { Element.update("prod_table", "
\n\n
\n \nProduct 1 \nVendor 1\n
\n \nProduct 2 \nVendor 2\n
\n \nProduct 3 \nVendor 3\n
..
\n\n
"); } catch(e){ alert(''RJS error:\n\n'' + e.toString());
alert(''Element.update(\"prod_table\",\"
\\n
\\n\\n
... and then the whole table again as a long string (it renders the
error message on the screen.
What could be the problem?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---