4
我正在使用twitter引導和will_paginate,並且我有一張表,我想實現無限滾動。Rails無盡頁面/無限滾動
該表格是固定長度並已經滾動。我最近跟着Railscasts Episode#114的修訂版本,但它不適合我。當我滾動到表格底部時,它表示獲取更多文章,但實際上並沒有獲取更多文章。
這裏是我的代碼:
Articles.js.coffee:
jQuery ->
if $('.pagination').length
$(articles).scroll ->
url = $('.pagination .next_page').attr('href')
if url && $(articles).scrollTop() > $(document).height() -
$(articles).height() + 585
$('.pagination').text('Fetching more players...')
$.getScript(url)
$(articles).scroll()
index.js.erb的:
$('#articles').append('<%= j render(@articles) %>');
<% if @articles.next_page %>
$('.pagination').replaceWith('<%= j will_paginate(@articles) %>');
<% else %>
$('.pagination').remove();
<% end %>
我的控制器和桌子都稱爲文章。我不知道它是不是工作,因爲它是一個表與整個頁面。
如果我需要發佈更多文件,請讓我知道。
爲了將來的參考,請不要雙重發布問題,如果您有其他詳細信息可以幫助我們回答您的問題,請編輯原始問題。 – Noz
打開Firebug,你看到有什麼JS錯誤嗎? –
[Rails Infinite Scroll/Endless Page Table with will \ _paginate]可能重複(http://stackoverflow.com/questions/12994866/rails-infinite-scroll-endless-page-table-with-will-paginate) –