Skip to content

Meteor package that provide developers a simple way to paginate collections

Notifications You must be signed in to change notification settings

KiqueDev/Meteor-Paginate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meteor-Paginate

Meteor package that provide developers a simple way to paginate collections.

Checkout my Live Demo

Usage

mrt add paginate  

-Make sure to publish and subscribe your collection before usage.
Example:

////// CLIENT SIDE ///////////////
Creates collection

Coll = new Meteor.Collection("coll");  

Subscribe collection at autorun

Meteor.autorun(function() {  
    Meteor.subscribe("coll");  
});  

Create object paginate. //Paginate(COLLECTION, TEMPLATE NAME, {OPTIONS});
Default Settings in {OPTIONS}:
{ perPage:5, pathName: (your collection name in lowercase), templateData: (your collection name in lowercase)
}

perPage is the number of item you want to show per page
pathName is the path from the url where will direct you
to your pageinate following by a number ex: ...pathName/1
templateData is the data use in your template in your handlebars ex: {{#each templateData}} ....{{/each}}

SINGLE USAGE:

var P = new Paginate(Coll, "myTemplate"); 

MULTIPLE USAGE:

var P1 = new Paginate(Coll1, "myTemplate", {perPage: 10, templateData:"sameTemplateData"}); 
var P2 = new Paginate(Coll2, "myTemplate", {perPage: 2, templateData:"sameTemplateData"}); 

Also you can use my embbedded template design to paginate previous or next pages by just adding the following in to your template

{{> paginate_pages}}

////// SERVER SIDE ///////////////
Publish collection

Meteor.publish("coll", function() {   
  return Coll.find({}, {fields: {}});  
});  

About

Meteor package that provide developers a simple way to paginate collections

Resources

Stars

Watchers

Forks

Packages

No packages published