carlosalvidrez:pagination-blaze

v0.0.1Published 2 years ago

carlosalvidrez:pagination-blaze

Forked from Kurounin:Pagination-Blaze

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    templatePagination: function () {
3        return Template.instance().pagination;
4    },
5    clickEvent: function() {
6        return function(e, templateInstance, clickedPage) {
7            e.preventDefault();
8            console.log('Changing page from ', templateInstance.data.pagination.currentPage(), ' to ', clickedPage);
9        };
10    }
11});

In the template html file add the paginator

1{{> defaultBootstrapPaginator pagination=templatePagination onClick=clickEvent limit=10 containerClass="text-center"}}

For Semantic UI, use the following configuration

1{{> defaultBootstrapPaginator pagination=templatePagination onClick=clickEvent limit=10 paginationClass="ui pagination menu" itemClass="item" wrapLinks=false}}

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())