mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2812 from Rhym/patch-1
Add a reference for setting the Limit of items.
This commit is contained in:
commit
d29b083b84
@ -76,6 +76,20 @@ page. In this situation the automatic limiting done by `[api:PaginatedList]`
|
||||
will break the pagination. You can disable automatic limiting using the
|
||||
`[api:PaginatedList->setLimitItems()]` method when using custom lists.
|
||||
|
||||
## Setting the limit of items to be displayed on a page ##
|
||||
|
||||
To set the limit of items displayed in a paginated page use the `[api:PaginatedList->setPageLength()]` method. e.g:
|
||||
|
||||
:::php
|
||||
/**
|
||||
* Returns a paginated list of all pages in the site, and limits the items displayed to 4 per page.
|
||||
*/
|
||||
public function PaginatedPagesLimit() {
|
||||
$paginatedItems = new PaginatedList(Page::get(), $this->request);
|
||||
$paginatedItems->setPageLength(4);
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
## Related
|
||||
|
||||
* [Howto: "Grouping Lists"](/howto/grouping-dataobjectsets)
|
||||
* [Howto: "Grouping Lists"](/howto/grouping-dataobjectsets)
|
||||
|
Loading…
Reference in New Issue
Block a user