carlosalvidrez:pagination-blaze

v0.0.2Published last year

carlosalvidrez:pagination-blaze

Forked from Kurounin:Pagination-Blaze in order to make it compatible with Meteor 3.

This package provides a Bootstrap 5 Paginator Blaze template to be used with the carlosalvidrez:pagination package. It can also be configured to use custom styling.

Usage

In the template helpers you need to define a helper to return the pagination instance and you can define an optional callback which should be called right before changing the page

1Template.myList.helpers({
2
3    templatePagination: () => Template.instance().pagination,
4    
5    clickEvent: () => {
6        return (e, templateInstance, clickedPage) => {
7            e.preventDefault();
8            console.log(
9                'Changing page from ', 
10                templateInstance.data.pagination.currentPage(), 
11                ' to ', 
12                clickedPage
13            );
14        };
15    }    
16    
17});

In the template html file add the paginator

1{{> defaultBootstrapPaginator 
2        pagination=templatePagination 
3        onClick=clickEvent 
4        limit=10 
5        containerClass="text-center"
6}}

For Semantic UI, use the following configuration

1{{> defaultBootstrapPaginator 
2        pagination=templatePagination 
3        onClick=clickEvent 
4        limit=10 
5        paginationClass="ui pagination menu" 
6        itemClass="item" 
7        wrapLinks=false
8}}

Available template parameters are:

  • pagination: pagination instance
  • limit: the maximum number of page links to display
  • containerClass: optional container class for the paginator
  • paginationClass: optional class for the ul element (defaults to pagination)
  • itemClass: optional class for the page links elements
  • wrapLinks: if set to true page links will be wrapped in li elements (defaults to true)
  • onClick: optional callback to be called when page link is clicked (default callback runs e.preventDefault())