Add a reference for setting the Limit of items.

This commit is contained in:
Ryan Potter 2014-01-31 11:20:17 +13:00
parent 587c489d0f
commit 75de6a2848

View File

@ -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)