@@ -308,6 +308,83 @@ class ExampleGridView extends AbstractGridView
308308Grid Views and List Views share the same filters.
309309A complete list of available filters can be found in the [ List View documentation] ( list_views.md#filtering ) .
310310
311+ ## Customization
312+
313+ ### Number of Items
314+
315+ By default, grid views use a pagination that shows 20 rows per page. You can set a custom number of rows per page:
316+
317+ ``` php
318+ class ExampleGridView extends AbstractGridView
319+ {
320+ public function __construct()
321+ {
322+ $this->setRowsPerPage(50);
323+ }
324+ }
325+ ```
326+
327+
328+ ### Additional Parameters
329+
330+ A grid view can be provided with additional parameters, e.g. to filter them by a specific category:
331+
332+ ``` php
333+ class ExampleGridView extends AbstractGridView
334+ {
335+ public function __construct(public readonly int $categoryID)
336+ {
337+ parent::__construct();
338+ }
339+
340+ #[\Override]
341+ protected function createObjectList(): DatabaseObjectList
342+ {
343+ $list = new ExampleList();
344+ $list->getConditionBuilder()->add('categoryID = ?', [$this->categoryID]);
345+
346+ return $list;
347+ }
348+
349+ #[\Override]
350+ public function getParameters(): array
351+ {
352+ return ['categoryID' => $this->categoryID];
353+ }
354+ }
355+ ```
356+
357+ ``` php
358+ class ExampleListPage extends AbstractGridViewPage
359+ {
360+ public int $categoryID = 0;
361+
362+ #[\Override]
363+ public function readParameters()
364+ {
365+ parent::readParameters();
366+
367+ if (isset($_REQUEST['categoryID'])) {
368+ $this->categoryID = \intval($_REQUEST['categoryID']);
369+ }
370+ }
371+
372+ #[\Override]
373+ protected function createGridView(): AbstractGridView
374+ {
375+ return new ExampleGridView($this->categoryID);
376+ }
377+
378+ #[\Override]
379+ protected function getBaseUrlParameters(): array
380+ {
381+ return [
382+ 'categoryID' => $this->categoryID,
383+ ];
384+ }
385+ }
386+ ```
387+
311388## Events
312389
313390Existing grid views can be modified using events.
0 commit comments