1. Domino UI
  2. Components
  3. Pagination
Top Basic Scrolling Advanced Pager Docs

Pagination

BasePagination provides a base implementation for pagination components in Domino UI. It supports features like navigating to pages, updating pages by total count, and more.

Usage example:

 
 // Create a pagination component
 BasePagination pagination = new BasePagination() {
     // Override the moveToPage method to implement navigation logic
     protected void moveToPage(int page, boolean silent) {
         // Your implementation here
     }
 };

 // Add pagination to a container element
 container.appendChild(pagination.element());

 // Update the pagination with total count and page size
 pagination.updatePagesByTotalCount(100);
 

T

The concrete type of the pagination component.

See also :

Examples

Basic pagination Simple pager with navigation arrows.

Scrolling pagination Pager that scroll a number of pages at once

Advanced pagination Pager with pages dropdown

Simple pagers Pagers with just next/previous arrows.

API Docs: Pagination

Constructors

public void BasePagination()
Creates a new BasePagination instance.

Public methods

public T showFirstLastPage(boolean visible)
Shows or hides the "First" and "Last" page navigation buttons.

visible

true to show, false to hide.



Returns:

The BasePagination instance.

public T showNextPrevPage(boolean visible)
Shows or hides the "Next" and "Previous" page navigation buttons.

visible

true to show, false to hide.



Returns:

The BasePagination instance.

public T updatePagesByTotalCount(int totalCount)
Updates the pagination based on the total count of items. This method calculates the number of pages based on the total count and the current page size, and then updates the pagination accordingly.

totalCount

The total count of items.



Returns:

The BasePagination instance.

public T updatePagesByTotalCount(int totalCount, boolean silent)
Updates the pagination based on the total count of items. This method calculates the number of pages based on the total count and the current page size, and then updates the pagination accordingly.

totalCount

The total count of items.

silent

true to update silently (without triggering listeners), false otherwise.



Returns:

The BasePagination instance.

public T updatePagesByTotalCount(int totalCount, int pageSize)
Updates the pagination based on the total count of items and a custom page size. This method calculates the number of pages based on the total count and the specified page size, and then updates the pagination accordingly.

totalCount

The total count of items.

pageSize

The custom page size.



Returns:

The BasePagination instance.

public T updatePagesByTotalCount(int totalCount, int pageSize, boolean silent)
Updates the pagination based on the total count of items and a custom page size. This method calculates the number of pages based on the total count and the specified page size, and then updates the pagination accordingly.

totalCount

The total count of items.

pageSize

The custom page size.

silent

true to update silently (without triggering listeners), false otherwise.



Returns:

The BasePagination instance.

public T updatePages(int pages)
Updates the pagination with the specified number of pages. This method updates the pagination with the given number of pages and the current page size.

pages

The number of pages.



Returns:

The BasePagination instance.

public T updatePages(int pages, int pageSize)
Updates the pagination with the specified number of pages and a custom page size. This method updates the pagination with the given number of pages and the specified page size.

pages

The number of pages.

pageSize

The custom page size.



Returns:

The BasePagination instance.

public T gotoPage(int page)
Navigates to the specified page. If the provided page number is within the valid page range, this method will move the pagination to the specified page.

page

The page number to navigate to.



Returns:

The BasePagination instance.

public T gotoPage(int page, boolean silent)
Navigates to the specified page. If the provided page number is within the valid page range, this method will move the pagination to the specified page.

page

The page number to navigate to.

silent

true to navigate silently (without triggering listeners), false otherwise.



Returns:

The BasePagination instance.

public T nextPage()
Navigates to the next page.

Returns:

The BasePagination instance.

public T previousPage()
Navigates to the previous page.

Returns:

The BasePagination instance.

public T nextPage(boolean silent)
Navigates to the next page.

silent

true to navigate silently (without triggering listeners), false otherwise.



Returns:

The BasePagination instance.

public T previousPage(boolean silent)
Navigates to the previous page.

silent

true to navigate silently (without triggering listeners), false otherwise.



Returns:

The BasePagination instance.

public T gotoFirst()
Navigates to the first page.

Returns:

The BasePagination instance.

public T gotoLast()
Navigates to the last page.

Returns:

The BasePagination instance.

public T gotoFirst(boolean silent)
Navigates to the first page.

silent

true to navigate silently (without triggering listeners), false otherwise.



Returns:

The BasePagination instance.

public T gotoLast(boolean silent)
Navigates to the last page.

silent

true to navigate silently (without triggering listeners), false otherwise.



Returns:

The BasePagination instance.

public T markActivePage()
Marks the currently active page as active by adding the "active" CSS class. If the "markActivePage" property is set to true , this method is automatically called when navigating between pages.

Returns:

The BasePagination instance.

public T setMarkActivePage(boolean markActivePage)
Sets whether to mark the active page with the "active" CSS class.

markActivePage

true to mark the active page as active, false to remove the "active" class.



Returns:

The BasePagination instance.

public T gotoPageByRecordIndex(int index)
Navigates to the page containing the record at the specified index. This method determines the appropriate page based on the record index and optionally considers if change listeners are paused.

index

The zero-based index of the record for which the page should be navigated.



Returns:

The current instance of the class, allowing method chaining.

public T gotoPageByRecordIndex(int index, boolean silent)
Navigates to the page that contains the specified record index.

index

the zero-based index of the record to navigate to

silent

if true, suppresses side effects or notifications resulting from the navigation



Returns:

the current instance after performing the navigation

public int getTotalCount()
Gets the total count of items.

Returns:

The total count of items.

public T setPageSize(int pageSize)
Sets the page size for pagination.

pageSize

The page size.



Returns:

The BasePagination instance.

public int getPageSize()
Gets the page size for pagination.

Returns:

The page size.

public int activePage()
Gets the active page index.

Returns:

The active page index.

public int getPagesCount()
Gets the total number of pages.

Returns:

The total number of pages.

public T withNavElement(ChildHandler<T, NavElement> handler)
Configures the navigation element of the pagination using a custom child handler.

handler

A ChildHandler to configure the navigation element.



Returns:

The BasePagination instance.

public T withPageList(ChildHandler<T, UListElement> handler)
Configures the page list element of the pagination using a custom child handler.

handler

A ChildHandler to configure the page list element.



Returns:

The BasePagination instance.

public T withPrevPageNav(ChildHandler<T, PagerNavItem> handler)
Configures the previous page navigation element of the pagination using a custom child handler.

handler

A ChildHandler to configure the previous page navigation element.



Returns:

The BasePagination instance.

public T withNextPageNav(ChildHandler<T, PagerNavItem> handler)
Configures the next page navigation element of the pagination using a custom child handler.

handler

A ChildHandler to configure the next page navigation element.



Returns:

The BasePagination instance.

public T withFirstPageNav(ChildHandler<T, PagerNavItem> handler)
Configures the first page navigation element of the pagination using a custom child handler.

handler

A ChildHandler to configure the first page navigation element.



Returns:

The BasePagination instance.

public T withLastPageNav(ChildHandler<T, PagerNavItem> handler)
Configures the last page navigation element of the pagination using a custom child handler.

handler

A ChildHandler to configure the last page navigation element.



Returns:

The BasePagination instance.

public T pauseChangeListeners()
Pauses change listeners for this pagination component.

Returns:

The BasePagination instance.

public T resumeChangeListeners()
Resumes change listeners for this pagination component.

Returns:

The BasePagination instance.

public T togglePauseChangeListeners(boolean toggle)
Toggles the state of change listeners for this pagination component.

toggle

If true, change listeners will be paused; otherwise, they will be resumed.



Returns:

The BasePagination instance.

public Set<ChangeListener<? super Integer>> getChangeListeners()
Gets the set of change listeners registered for this pagination component.

Returns:

A set of ChangeListener objects.

public boolean isChangeListenersPaused()
Checks if change listeners for this pagination component are currently paused.

Returns:

True if change listeners are paused, false otherwise.

public T triggerChangeListeners(Integer oldValue, Integer newValue)
Triggers change listeners with the old and new values.

oldValue

The old value before the change.

newValue

The new value after the change.



Returns:

The BasePagination instance.

We are a group of passionate people who love what we do

Donate & Support Us