Page it!
With this lib you can fully manipulate pagination events and fetch information from an endpoint.
Also you can, in fact you must (if you want to use it), integrate this tool with your own pagination component.
Instalation
Download it via npm
:
npm i jquery.page-it@latest --save
Available Methods
Methods | Params | Description |
---|
first | void | Loads first page. |
prev | void | Loads previous page. |
next | void | Loads next page. |
last | void | Loads last page. |
to | {int} pageIndex | Loads the specifyied page. |
on | {string} eventName, {callable} callback | Registers an event listener. |
trigger | {string} eventName, {array} params | Triggers an event. |
setMeta | {object} meta (see meta schema) | Sets the meta property, this property is used to control pagination numbers. |
setCurrent | {int} current | Sets the current page and updates dependent meta. |
setRequestData | {object} requestData | Accepts a callback to update the request data. |
Options
Default options are:
{
autoStart: false,
cache: true,
ajax: {
url: '',
cache: false,
global: true,
method: 'get',
},
target: null,
fillMode: 'replace',
meta: metaSchema
}
Meta Schema
{
size: null,
first: 1,
prev: null,
current: null,
next: null,
last: null,
total: null
}