Ajax Pager API

Categories

Component ID

2677848

Component name

Ajax Pager API

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

692

Component created

Component changed

Component body

This module is meant for Drupal back-end developers, who are working with custom pages such as reports, content listing using custom queries who wish to replace the stock Drupal page with a pager that fetches the paged content using Ajax. This modules pager also retains the history of the pages visited by the user from the paged element using Benjamin Lupton's History.js so that users can navigate to the previous pages using the browser back and forward buttons.

Installation:

  1. Download the latest version of History.js
    (from https://github.com/balupton/History.js)
  2. Extract the contents of the archive to:
    /sites//libraries/balupton-history.js
  3. Such that the bundled directory exists at:
    <...>/libraries/balupton-history.js/scripts/bundled
  4. Verify You have the Libraries API installed
  5. Disable the Overlay Module

Usage:

Instead of using normal drupal pager, we can use the ajax pager. A normal Drupal pager usage is in code is as follows:

$output['pager'] = array(
  '#theme' => 'pager',
);

Instead of this you can use the following code for utilizing the ajax pager api:

$output['pager'] = array(
  '#markup' => theme('ajax_pager', array(
    'parameters' => array(
      'selector' => 'block-system-main',
     ),
  )),
);

Here selector is the id of the div, on which the content is getting displayed.