Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8744675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:52:44+00:00 2026-06-13T11:52:44+00:00

I am using twitter bootstrap and will_paginate, and I have a table on which

  • 0

I am using twitter bootstrap and will_paginate, and I have a table on which I would like to implement infinite scrolling.

That table is a fixed length and already scrolls. I recently followed the revised version of Railscasts Episode #114, but it does not work for me. When I scroll to the bottom of the table, it says fetching more articles, but it does not actually fetch more articles.

Here is my code:

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 %>

My controller and table are both called Articles. I do not know if it is not working because it is a table versus a whole page.

Please let me know if I need to post any more files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:52:45+00:00Added an answer on June 13, 2026 at 11:52 am

    I figured it out by following the railscasts episode 114 but I had to make some changes in order to make it work.

    Here is my new code:

    articles.js.coffee

    jQuery ->
       if $('.pagination').length
          $('#articles_table').scroll ->
                  url = $('.pagination .next_page').attr('href')          
                  if url &&  $('#articles_table')[0].scrollHeight -    
                  $('#articles_table').scrollTop() < 700                  
                          $('.pagination').text('Fetching more users...')
                          $.getScript(url)
    $('#articles_table').scroll()
    

    index.html.erb

    <table class="table table-striped table-bordered span8 table-condensed"     
     id="articles_table" >
    <thead class="header">
      <tr>
          <th>ID</th>
          <th>Title</th>
          <th>Description</th>
          <th>Created_At</th>
      </tr>
    </thead>
    <tbody>
    <%= render @articles %>
    
    </tbody>
    

    index.js.erb

    $('#articles_table').append('<%= j render(@articles) %>');
    <% if @articles.next_page %>
    $('.pagination').replaceWith('<%= j will_paginate(@articles) %>');
    <% else %>
    $('.pagination').remove();
    <% end %>
    

    _article.html.erb

    <tr>
          <td> <%= article_counter +1 %> </td>
          <td> <%= article.Title %> </td>
          <td> <%= article.Description %> </td>
          <td> <%= article.Created_At %> </td>
    </tr>
    

    I just had to change around the javascript a little bit to make it work for me and then create a partial. The javascript changes were because I was using a fixed length table not the whole page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using twitter bootstrap, which is working nicely, but I would like
I am using twitter bootstrap and I would like a container div to stretch
I am using twitter bootstrap and have a fixed nav bar. The navbar has
I am using Twitter Bootstrap in a project, and would like to contrain the
Using Twitter Bootstrap's bootstrap-tab.js, I have: <ul class=tabnavcenter id=myTab> <li class=active><a href=#home data-toggle=tab>about</a></li> <li><a
I developed a site using twitter bootstrap and it seems that the responsive layout
I have been using twitter bootstrap to build a small blog site for myself
While creating a website using Twitter Bootstrap's carousel, it seems that some scripts are
I have a simple form with a legend using Twitter Bootstrap. I want to
I'm using Twitter's Bootstrap topbar. When I click on some navigation href href=#SomeDivName Like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.