Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Paginatio plugin for RailwayJS MVC framework
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

About

Simple pagination plugin for RailwayJS MVC framework.

Installation

npm install railway-pagination

Usage

Step 1. Plug-in: npmfile.js

    require('railway-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

Something went wrong with that request. Please try again.