Skip to content

Commit

Permalink
Docs: Pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
radimvaculik committed May 4, 2024
1 parent 92e4434 commit 74a8222
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
1 change: 1 addition & 0 deletions .docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Table of contents
- [Inline edit](inline-edit.md)
- [Inline add](inline-add.md)
- [Localization](localization.md)
- [Pagination](pagination.md)
12 changes: 0 additions & 12 deletions .docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
```
34 changes: 34 additions & 0 deletions .docs/pagination.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 74a8222

Please sign in to comment.