DE
devpuppy/ajax_will_paginate
A simple layer over will_paginate to provide unobtrusive AJAX with jQuery or Prototype
= AjaxWillPaginate
http://github.com/devpuppy/ajax_will_paginate
An easy-to-use Rails plugin that works with WillPaginate to provide pagination via AJAX.
- Unobtrusive JavaScript leaves existing WillPaginate markup alone
- Can be applied from JavaScript files or within your Rails templates
- Works with jQuery or Prototype.js with an option for Low-Pro
= Example
app/views/items/index.html.erb
<%= ajax_will_paginate_javascript_include_tag %>
...
<%= render :partial => 'items', :object => @Items %>
app/views/items/_items.html.erb
<%= render :partial => 'item', :collection => items %>
<%= ajax_will_paginate @Items, :param_name => 'item_page' %>
app/controllers/items_controller.rb
def index
@Items = Item.all.paginate :param_name => 'item_page'
respond_to do |wants|
wants.html
wants.js { ajax_will_paginate 'items', :partial => 'items', :object => @Items }
end
end
= Install
= Configure
= TODO
- jQuery option
- Low-Pro option
- Persistence using Low-Pro and jQuery's .live()
- Smart about selectors, not just id's
- Unit tests
- Automagically pull target selector from params
- Callbacks, especially for loading spinner
- Selectively copy javascripts with install.rb
- Proper Rails 3 will_paginate dependency
Copyright (c) 2010 Justin Jones, released under the MIT license
MIT License
Created February 11, 2010
Updated October 9, 2013