Reputation: 123
I wanna use infinite scroll down pagination in rails and want to pass the information like page number so that next data can be retrieved in the action and for the scroll down i can append the data to the existing data in my view.
is there any thing scroll down pagination that we can do with the will_paginate?
Thanks in advance --Vam.
Upvotes: 3
Views: 6057
Reputation: 1815
to see how to do this yourself, have a look at
http://railscasts.com/episodes/174-pagination-with-ajax
to see how to use will_paginate with ajax (jquery). Ryan shows how to modify the usual will_paginate approach. First how to modify the links of the pagination bar and then he shows how to modify the view to display newly loaded objects... In this video he replaces shown items by newly loaded items. You'd just have to tweak the index.js.erb to append them.
nevertheless ... you might also want to checkout his video
http://railscasts.com/episodes/114-endless-page
in which he shows what you asked for but without will_pagination
Upvotes: 3
Reputation: 4102
This Jquery plugin may help https://github.com/jney/jquery.pageless
Upvotes: 5