Skip to main content

Pagination

class pyromod.nav.Pagination

The pyromod.nav.Pagination class provides a utility for creating paginated interfaces with customizable pagination controls. It is designed to handle a list of objects and display them in a paginated manner.

Constructor parameters

ParametersTypeDescription
objectslistThe list of items to paginate.
page_datafunctionA function to customize the data displayed in the pagination controls for each page. The default function returns the page number as a string.
item_datafunctionA function to customize the data displayed for each item in the pagination. The default function prefixes each item with the page number.
item_titlefunctionA function to customize the title displayed for each item. The default function prefixes each item with the page number in square brackets.

method create

method async create(page, lines=5, columns=1)

Creates a paginated interface for the specified page.

Parameters:

ParameterTypeDescription
pageintThe page number to display.
linesintThe number of lines (rows) per page.
columnsintThe number of columns per page.

Returns:

A list of paginated items and pagination controls in the form of button data.