Last 6 hours I am trying to get this working. I tried several code examples but none of them seem to work. I read will_paginate is not designed for rails 3. I got it working to a point where it does pagination but cannot make ajax requests. Tried JQuery to help that ajax problem , no luck there too. This is odd, doesn't take this much try to a small thing working. Pagination is happening but it has to make an ajax call. I really need some good advice here before I go crazy.
View -
<div id="digg_pagination">
<div class="page_info">
<%= page_entries_info @list_page %>
</div>
<%= will_paginate(@list_page , :container => true, :remote => true, :page_links => true ) %>
</div>
Generates HTML -
<div id="digg_pagination">
<div class="page_info">
Displaying Item<b>2 - 2</b> of <b>2</b> in total
</div>
<div class="pagination" remote="true">
<a class="previous_page" rel="prev start" href="/item/item_list?page=1">← Previous</a>
<a rel="prev start" href="/item/item_list?page=1">1</a>
<em class="current">2</em> <span class="next_page disabled">Next →</span>
</div>
</div>
JS -
$(function(){
$('#item_list').html(<%= (render :partial => 'item_list').to_json.html_safe %>);
$('.pagination a').attr('data-remote', 'true'); # Doesn't add the html attribute
$('.pagination a').livequery('click', function() {
$.getScript(this.href);
return false;
});
}); #Tried bind 'click', live, livequery. none worked.