> For the complete documentation index, see [llms.txt](https://docs.silkbuilder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.silkbuilder.com/js_object/pagination.js.md).

# Pagination

The Pagination Class provides properties, methods, and events to interface with the HTML tags generated by the `<silk:Pagination>` tag.

**Kind**: global class

## Properties

| Name          | Type      | Description                                             |
| ------------- | --------- | ------------------------------------------------------- |
| $pagination   | `Object`  | jQuery object referencing the pagination HTML tag.      |
| currentPage   | `Integer` | The index of the selected page                          |
| totalRows     | `Integer` | The total rows returned by the query.                   |
| totalPages    | `Integer` | The total generated pages.                              |
| $pageStartRow | `Integer` | The page starting the pages list view.                  |
| $pageSize     | `Integer` | The number of items per page.                           |
| $showPages    | `Integer` | Number of pages to be displayed                         |
| $leftArrow    | `Object`  | jQuery object referencing the pagination's left arrow.  |
| $rightArrow   | `Object`  | jQuery object referencing the pagination's right arrow. |

## Constructor

### new Pagination(id, size, pages, label)

Returns a Pagination instance.

| Param | Type      | Default   | Description                                       |
| ----- | --------- | --------- | ------------------------------------------------- |
| id    | `String`  |           | Unique identifier.                                |
| size  | `Integer` | `500`     | The number of target items per page.              |
| pages | `Integer` | `10`      | The number of pages listed in the pagination bar. |
| label | `String`  | `Records` | Optional pagination label.                        |

## Methods

### clean()

Method to clean the pagination container.

**Kind**: instance method of [`Pagination`](#Pagination)<br>

### on

Load events to respond to the pagination's interactions. To set an event, use this code: `Pagination.on(<eventName>, function(){<code>})`.

**Kind**: instance property of [`Pagination`](#Pagination)

| Param         | Type       | Description                   |
| ------------- | ---------- | ----------------------------- |
| eventName     | `String`   | The event's name.             |
| eventFunction | `function` | The function to be triggered. |

## Events

### on:click

The event is triggered when a page button is clicked. Created with the `Pagination.on("click", function(){})` method.

**Kind**: event emitted by [`Pagination`](#Pagination)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.silkbuilder.com/js_object/pagination.js.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
