GridFieldConfigurablePaginator
class GridFieldConfigurablePaginator extends GridFieldPaginator (View source)
GridFieldConfigurablePaginator paginates the GridField list and adds controls to the bottom of the GridField. The page sizes are configurable.
Properties
protected | int | $itemsPerPage | from GridFieldPaginator | |
protected | string | $itemClass | Which template to use for rendering |
|
protected | $throwExceptionOnBadDataType | See setThrowExceptionOnBadDataType() |
from GridFieldPaginator | |
protected | $totalItems | from GridFieldPaginator | ||
protected | GridField | $gridField | ||
protected | GridState_Data | $gridFieldState | ||
protected | int[] | $pageSizes |
Methods
Determine what happens when this component is used with a list that isn't SS_Filterable.
See setThrowExceptionOnBadDataType()
Check that this dataList is of the right data type.
Gets the state from the current request's GridField and sets some default values on it
Add the configurable page size options to the template data
Set the first shown record number. Will be stored in the state.
Get the total number of pages, given the current number of items per page. The total
pages might be higher than
Get the page currently active. This is calculated by adding one to the previous number of pages calculated via the "first shown record" position.
Set the GridField so it can be used in other parts of the component during this request
Returns an array containing the arguments for the pagination: total rows, pages, first record etc
Returns FormActions for each of the pagination actions, in an array
Details
__construct(int $itemsPerPage = null, int $pageSizes = null)
No description
setThrowExceptionOnBadDataType($throwExceptionOnBadDataType)
Determine what happens when this component is used with a list that isn't SS_Filterable.
- true: An exception is thrown
- false: This component will be ignored - it won't make any changes to the GridField.
By default, this is set to true so that it's clearer what's happening, but the predefined GridFieldConfig subclasses set this to false for flexibility.
getThrowExceptionOnBadDataType()
See setThrowExceptionOnBadDataType()
protected
checkDataType($dataList)
Check that this dataList is of the right data type.
Returns false if it's a bad data type, and if appropriate, throws an exception.
array
getActions($gridField)
No description
handleAction(GridField $gridField, $actionName, $arguments, $data)
No description
protected GridState_Data
getGridPagerState(GridField $gridField = null)
Gets the state from the current request's GridField and sets some default values on it
ArrayData|null
getTemplateParameters(GridField $gridField)
Add the configurable page size options to the template data
{@inheritDoc}
array
getHTMLFragments($gridField)
No description
setItemsPerPage($num)
No description
int
getItemsPerPage()
No description
int
getTotalRecords()
Get the total number of records in the list
int
getFirstShown()
Get the first shown record number
$this
setFirstShown(int $firstShown = 1)
Set the first shown record number. Will be stored in the state.
int
getLastShown()
Get the last shown record number
int
getTotalPages()
Get the total number of pages, given the current number of items per page. The total
pages might be higher than
int
getCurrentPage()
Get the page currently active. This is calculated by adding one to the previous number of pages calculated via the "first shown record" position.
int
getNextPage()
Get the next page number
int
getPreviousPage()
Get the previous page number
$this
setPageSizes(array $pageSizes)
Set the page sizes to use in the "Show x" dropdown
array
getPageSizes()
Get the sizes for the "Show x" dropdown
ArrayList
getPageSizesAsList()
Gets a list of page sizes for use in templates as a dropdown
GridField
getGridField()
Get the GridField used in this request
$this
setGridField(GridField $gridField)
Set the GridField so it can be used in other parts of the component during this request
protected array
getPagerArguments()
Returns an array containing the arguments for the pagination: total rows, pages, first record etc
GridField_FormAction[]
getPagerActions(array $controls, GridField $gridField)
Returns FormActions for each of the pagination actions, in an array