From 74a82224ef23405532e66f03a80a49d7a2733c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Vaculi=CC=81k?= Date: Sat, 4 May 2024 23:02:35 +0200 Subject: [PATCH] Docs: Pagination --- .docs/README.md | 1 + .docs/index.md | 12 ------------ .docs/pagination.md | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 .docs/pagination.md 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.