27

After a recent railscast I'm using the kaminari gem in my website and I want to do ajax pagination

The kaminari docs say: the helper supports Rails 3 unobtrusive Ajax.

Does anyone have any hints or tutorials on how to do this? I'm using jquery, rails 3 etc. I guess I need something in my application.js file that listens to the buttons in the pagination nav

If anyone needs code I will post it

stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189

2 Answers2

66

Thank you for using Kaminari.

I just created a brief sample project using Kaminari and jQuery, as I believe this is the best way to show you the actual code. git log tells you more than words!

So, could you take a look at the commits here on "ajax" branch? https://github.com/amatsuda/kaminari_example/commits/ajax

Hope this helps!

Akira Matsuda
  • 1,854
  • 14
  • 9
  • 1
    This is an old old example and does not seem to be working with Rails 3. I do get the call to the server however my view is not updating? Is there anyway someone could assist further? – Qaiser Wali Jun 26 '14 at 15:10
  • This assumes you have just a restful index action and nothing else, I am investigating other options. – Alex C Jul 09 '14 at 14:26
0

I did it according to the following simple article and everything works pretty well

Ajax pagination with kaminari

Feuda
  • 2,335
  • 30
  • 28