A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.dhtmlx.com/suite/pagination/usage/ below:

JavaScript Pagination - Work with Pagination

Work with Pagination Setting/getting the active page​

It is possible to set the active page in a widget via Pagination API, i.e. with the help of the setPage() method. It takes the index of a page as a parameter:

You can also identify what page is currently active by using the getPage() method. It will return the index of the active page:

const pageIndex = pagination.getPage();
// -> 3

Related sample: Pagination. Get / set page index

Setting/getting count of items per page​

You can define the size of the widget page, i.e specify the number of items to be displayed on each page of the widget via the setPageSize() method. Pass the necessary number of items as a parameter to the method:

pagination.setPageSize(24);

Use the getPageSize() method to get the count of items displayed per page:

pagination.getPageSize();
// -> 22

Related sample: Pagination. Get / set page size

Getting total number of pages​

You can get the total number of pages by applying the getPagesCount() method:

const totalPages = pagination.getPagesCount();
// -> 10

Related sample: Pagination. Get page count


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4