Tuesday, May 19, 2009

infinite_page

Installation

Instructions

Infinite Page is used exactly like wil_paginate plugin but make sure of the following:

  • Obviously infinite_page helper method should be used instead of will_paginate
  • Infinite page parts (each part is one page in classic pagination) should be placed in a partial
  • infinite_page call should be included in this partial
  • in your controller,
    • XHR request: render only this partial
    • other requests: render whole page

Parameters

infinite_page take two parameters :

  • +collection = nil+:: a WillPaginate:Collection return by paginate function
  • +options = {}+:: see Options paragraph

Options

Most will_paginate and remote_function options are available along with infinite_page’s 2 additional options. will_paginate options are used for classic pagination rendered inside <noscript> tag. remote_function options are used for next page XHR loading. The most important option is +:update+. It indicates the DOM element ID that contains the partial. :url and :render options are automatically set by infinite_page. Please refer to will_paginate and remote_function references.

live demo : http://ror.zarlboro.com
sources : http://github.com/Ouziel/infinite_page_demo

No comments: