Basic Overview

Pageable Strategies

evolpagink provides a few strategies out of the box:

  • Based on page amount
  • Based on minimum item amount

The variant based on minimum item amount will try to load as many pages needed to reach the minimum specified amount of items.

prefetchMinimumItemAmount( // the default overload for indexed pages
    initialPage = 0, // self explanatory
    minimumItemAmount = 20 
)

The variant based on page amount will try to load the minimum specified amount of pages.

prefetchPageAmount(
    initialPage = 0,
    minimumPageAmount = 2
)

Visit the sample linked below and play with the UI scale to see how items are loaded.

Sample

Compose WasmJS evolpagink sample

How UI interacts with pagination

Pageable exposes a method, _onEvent, that allows the UI to tell it what is visible. Pageable will then refer to the provided strategy to compose the new intended visible list of pages.

The UI can report visible items to Pageable in 2 ways:

  • By reporting visible items. Fully dynamic, adaptive to viewport size. Recommended
  • By reporting the intended centered item. Non adaptive, the amount of pages loaded will be more static. This method is discouraged unless you have a specific use case.

Compose Multoplatform bindings report visible items by default. They observe the list state and report to Pageable accordingly.

See the API Reference for full details.

API Reference

Icon