kaminari_example
kaminari_example copied to clipboard
Ajax Pagination not working
I've implemented ajax pagination with kaminari based on the ajax branch example and I'm getting content-type html as the response so it is rending the whole page.
The page also doesn't update with the response content.
index.html.erb
<tbody id="foos">
<%= render @foos %>
</tbody>
...
<div id="paginator">
<%= paginate @properties, :remote => true %>
</div>
index.js.rb
$('#foos').html('<%= escape_javascript render(@foos) %>');
$('#paginator').html('<%= escape_javascript(paginate(@foos, :remote => true).to_s) %>');
_foos.html.rb
<tr>
<td><%= link_to image_tag(foo.bar %></td>
<td><%= link_to foo.title, foo %></td>
<td><%= foo.price %></td>
</tr>
foos_controller.rb
Foos.page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @foos}
end
rails version 3.2.14