A easy to use vanilla javascript plugin for pagination

Pagination, Paginate, Vanilla
bower install PaginateJS



This is a simple, yet very customizable, pagination snippet written on plain-old vanilla Javascript.


You can clone this repo or download the minified file here

After that, all you have to do is add a reference to this script on your HTML.

<script src="~/Scripts/Shared/paginate.js"></script>

Aditionally, you may install it using bower

bower install paginatejs

How To Use

Usage is pretty straightforward. Just create a paginate object and supply the options as desired

var paginate = new Paginate({
    source: /path/to/my/data, //the url with the JSON resource
    container: '#pagination', //the container element where the pagination template will render itself
    callback: function (requests){
        //callback actions

paginate.render(); // the function to render it all

here is a full list of the options:

  • source: the resource path
  • params: object with the additional parameters definition to use in the server request
  • container: the container element where the pagination template will render itself,
  • page: the page number,
  • pageSize: the page size,
  • total: you may pass the total of elements,
  • callback: a callback to run after the rendering,
  • template: a HTML template. Specify the page number and the max pages by using the mustache-like syntax ({{page}} and {{maxPages}})