npm.io
2.0.2 • Published 9 years ago

mithril-node-pagination

Licence
Version
2.0.2
Deps
1
Vulns
1
Weekly
0

mithril-node-pagination

A simple pagination component for Mithril and NodeJS.

Usage

const pagination = require('mithril-node-pagination');

const model = {
    "page": 2,
    "size": 10,
    "totalPages": 5,
    "total": 50,
    "more": true,
    "url": "go/to/page/${page}"
    ...
}

const ctrl = pagination.controller(model);
const view = pagination.view(ctrl);

Options

  • page: Page number.
  • size: size of each page.
  • totalPages: Total number of pages.
  • total: Total number of record available.
  • more: True if more pages exist.
  • pattern: URL template for pagination. Default is "${page}"

Test

Setup mithril-component-tools first. Then:

npm install
mct test pagination.js en

Keywords