DataProvider.Pagination (DataProvider v1.2.1) View Source
Pagination module provides struct with actual pagination data
for current DataProvider
Fields
page
- Current page of this data provider, by default equal 1. This value is dynamic, and can be changed in runtime.params
- Pagination params. This field containDataProvider.Pagination.Params
struct and uses for configuring inner logic ofDataProvider.Pagination
and/orDataProvider
pages
- List of values for fast move between pages. Every single page it isDataProvider.Pagination.Page
struct and this list sensitive for specific params, which used in his creation. This field most useful when you need to render list of pages under data table. More details you can find inDataProvider.Pagination.Params
andDataProvider.Pagination.Params
.
Link to this section Summary
Types
Schema of DataProvider.Pagination
.
Functions
Creates new DataProvider.Pagination
struct with received params.
Creates list of DataProvider.Pagination.Page
by received total count and current page.
Calculates end position for received pagination.
Returns current page value of DataProvider
by DataProvider.Pagination
Changes the value of field page
Changes the value of field page_size
Returns count of items, which gonna be put load into DataProvider.Data
Calculates starting position for received pagination.
Link to this section Types
Specs
t() :: %DataProvider.Pagination{ page: integer(), pages: [DataProvider.Pagination.Page.t()], params: DataProvider.Pagination.Params.t() }
Schema of DataProvider.Pagination
.
Contains:
page
- Current page of dataprovider.pages
- Pages which loaded for current paginationpage_size
- count of items in one page of data provider.
Link to this section Functions
Specs
Creates new DataProvider.Pagination
struct with received params.
Specs
Creates list of DataProvider.Pagination.Page
by received total count and current page.
Arguments
DataProvider.Pagination
structTotal count of items
Returns
Function returns DataProvider.Pagination
which :pages
field is fill
%DataProvider.Pagination{
...
pages: [
...
%DataProvider.Pagination.Page{},
%DataProvider.Pagination.Page{},
%DataProvider.Pagination.Page{},
...
]
...
}
Options
Options, that can affect result of this function
:pages_ahead
- The maximum count of pages, which will be loaded ahead of current position.
:pages_behind
- The maximum count of pages, which will be loaded behind of current position.
:load_first_page?
- Boolean value which indicates requirement of loading the first page in list.
:load_last_page?
- Boolean value which indicates requirement of loading the last page in list.
:load_opening_separator?
- Boolean value which indicates requirement of loading the separator page in list.
:load_closing_separator?
- Boolean value which indicates requirement of loading the separator page in list.
Specs
Calculates end position for received pagination.
Requires for calculating selection limit in list of data.
Specs
Returns current page value of DataProvider
by DataProvider.Pagination
Specs
Changes the value of field page
Specs
Changes the value of field page_size
Specs
Returns count of items, which gonna be put load into DataProvider.Data
Specs
Calculates starting position for received pagination.
Requires for calculating start position in list of data or offset in query condition