ember-cli-simple-pagination-component

0.1.1 • Public • Published

ember-cli-simple-pagination

This README outlines the details of collaborating on this Ember addon.

Installation

ember install ember-cli-simple-pagination-component

Usage

The only required property is totalResults

  • totalResults <int> The amount of items you have (usually the length of your model/collection)
  • maxPages <int> The number of pages to show in the pagination component before showing ellipsis
  • limit <int> The number of items per page
  • currentPage <int> self explanatory
  • dry <boolean>
  • onPage <fn> Function that will be called when changing page by clicking on any the pagination items but previous and next
  • onNext <fn> Function that will be called when clicking on next
  • onPrevious <fn> function that will be called when clickin on previous
{{simple-pagination totalResults=86}}
{{simple-pagination currentPage=13 totalResults=86}}

Block mode

The component can be used in block mode, in that case it won't be rendereing it's own components but only yielding

{{#simple-pagination totalResults=totalResults as |p|}}
  <p>{{p.currentPage}}</p>
  <p>{{p.totalPages}}</p>
  <div>
    {{#each p.range as |item|}}
      <button {{action p.onPage item}}>{{item}}</button>
    {{/each}}
  </div>
  <button {{action p.onNext}}>onNext</button>
  <button {{action p.onPrevious}}>onPrevious</button>
{{/simple-pagination}}

Readme

Keywords

Package Sidebar

Install

npm i ember-cli-simple-pagination-component

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • bl4ckm0r3