https://github.com/1602/railway-pagination
Paginatio plugin for RailwayJS MVC framework
https://github.com/1602/railway-pagination
Last synced: 3 months ago
JSON representation
Paginatio plugin for RailwayJS MVC framework
- Host: GitHub
- URL: https://github.com/1602/railway-pagination
- Owner: 1602
- Created: 2012-01-29T12:37:03.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2013-04-14T09:08:14.000Z (about 13 years ago)
- Last Synced: 2025-10-30T04:23:51.029Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 112 KB
- Stars: 9
- Watchers: 3
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About
Simple pagination plugin for RailwayJS MVC framework.
## Installation
npm install railway-pagination
## Usage
Step 1. Plug-in: **npmfile.js**
```javascript
require('railway-pagination');
```
Step 2. Controller: **posts_controller.js**
```javascript
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**
```javascript
paginate(posts);
```
## License
MIT