Skip to content

Simple pagination plugin for CompoundJS MVC framework.

Notifications You must be signed in to change notification settings

twickstrom/co-pagination

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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); %>

OR

	<%- paginate(clients, 3, {
		paginationClass: 'pagination pagination-centered',
		next: '&amp;gt;',
		last: '&amp;gt;&amp;gt;',
		first: '&amp;lt;&amp;lt;',
		prev: '&amp;lt;',
		linkClass: 'btn'
	}) %>

OR

	<%- paginate(clients, {
		paginationClass: 'pagination pagination-centered',
		next: '&amp;gt;',
		last: '&amp;gt;&amp;gt;',
		first: '&amp;lt;&amp;lt;',
		prev: '&amp;lt;',
		linkClass: 'btn'
	}) %>

License

MIT

About

Simple pagination plugin for CompoundJS MVC framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%