diff --git a/.docs/README.md b/.docs/README.md index 955b8a28..d999c387 100644 --- a/.docs/README.md +++ b/.docs/README.md @@ -14,3 +14,4 @@ Table of contents - [Inline edit](inline-edit.md) - [Inline add](inline-add.md) - [Localization](localization.md) +- [Pagination](pagination.md) diff --git a/.docs/index.md b/.docs/index.md index a9721d15..61a42325 100644 --- a/.docs/index.md +++ b/.docs/index.md @@ -82,15 +82,3 @@ class SimplePresenter extends BasePresenter ``` And that's it. Go check the app. :) - -When you don't like pagination, you can disable it: - -```php -$grid->setPagination(false); -``` - -But that would be a long dump - there are about a thousand rows in database. To change the items per page, select options you will do that via: - -```php -$grid->setItemsPerPageList([1, 100, 9090, 2]); -``` diff --git a/.docs/pagination.md b/.docs/pagination.md new file mode 100644 index 00000000..c56381d6 --- /dev/null +++ b/.docs/pagination.md @@ -0,0 +1,34 @@ +Table of contents + +- [Pagination](#pagination) + - [Custom template](#custom-template) + +# Pagination + +You can **disable** pagination, if you don't want to use it: + +```php +$datagrid->setPagination(false); +``` + +You can set custom items count per page: + +```php +$datagrid->setItemsPerPageList([10, 20, 50, 100, 200, 500]); +``` + +You can set default items per page: + +```php +$datagrid->setDefaultPerPage(50); +``` + +## Custom template + +You can set custom template for pagination: + +```php +$datagrid->setCustomPaginatorTemplate(__DIR__ . '/templates/datagrid/pagination.latte'); +``` + +See `DatagridPaginator/templates/data_grid_paginator.latte` for default template as an example.