co-pagination

0.0.1 • Public • Published

About

Simple pagination plugin for CompoundJS MVC framework.

Installation

npm install co-pagination

Usage

Step 1. Plug-in: npmfile.js

    require('co-pagination');

Step 2. Controller: posts_controller.js

    action(function index() {
       var page = req.param('page') || 1;
       Post.paginate({order: 'title', where: {'postStatus':'ACTIVE'}, limit: 10, page: page}, function (err, posts) {
           if (err) render({posts: posts});
       });
    });

Please notice that you can pass in the order and where option or leave them out.

Step 3. View: app/views/posts/index.ejs

    paginate(posts);

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i co-pagination

Weekly Downloads

2

Version

0.0.1

License

none

Last publish

Collaborators

  • bioform