I am trying some slightly modified Ajax examples from the latest
Rails beta book. Instead of modifying a list, I am trying to add rows
to a table. When the input text is beyond about 15 characters or so,
the table heading "Name" starts to get shifted to the right.
I''m
using Safari on 10.4.1 (I will try Firefox shortly). Any ideas? Below
are my index.rhtml, _location.rhtml and locations_controller.rb. Am I
missing something obvious?
<h1>Listing locations</h1>
<table id="my_table">
<tr><th>Name</th></tr>
<tbody id="my_list">
<%= render_partial_collection(''location'', @locations)
%>
</tbody>
</div>
</table>
<%= form_remote_tag(:update => "my_list",
:url => { :action => :add_item },
:position => "bottom") %>
Location name:
<%= text_field_tag :newitem %>
<%= submit_tag "Add location" %>
<%= end_form_tag %>
_location.rhtml:
<tr>
<td>
<%= location.name %>
</td>
</tr>
locations_controller.rb:
def index
@location_pages, @locations = paginate :location, :per_page => 10
end
def add_item
@location = Location.new(:name => @params[:newitem])
render_partial(''location'')
end
-joe