From 5f5d67137e1afbfbb4dd9e6b1489dacfbbc472f1 Mon Sep 17 00:00:00 2001 From: Pavlo Kulyk Date: Fri, 8 May 2026 13:30:41 +0300 Subject: [PATCH 1/2] feat: add dropdown for selecting page size options in list view --- .../13-standardPagesTuning.md | 29 ++++++++++++++ .../spa/src/components/ResourceListTable.vue | 35 +++++++++++++++++ adminforth/spa/src/views/ListView.vue | 39 +++++++++++++++++-- adminforth/types/Common.ts | 1 + 4 files changed, 100 insertions(+), 4 deletions(-) diff --git a/adminforth/documentation/docs/tutorial/03-Customization/13-standardPagesTuning.md b/adminforth/documentation/docs/tutorial/03-Customization/13-standardPagesTuning.md index 169fcb967..441ee8177 100644 --- a/adminforth/documentation/docs/tutorial/03-Customization/13-standardPagesTuning.md +++ b/adminforth/documentation/docs/tutorial/03-Customization/13-standardPagesTuning.md @@ -319,6 +319,35 @@ export default { ] ``` +### List Page Size Options +You can define available pagination sizes using options.listPageSizeOptions. This allows users to choose how many records they want to see per page in the list view. +```typescript title="./resources/apartments.ts" +export default { + resourceId: 'aparts', + options: { + ... + listPageSize: 10, + //diff-add + listPageSizeOptions: [10, 20, 50], + } + } + ] +``` + +#### How it works +- listPageSize defines the default number of records per page when the list is opened. +- listPageSizeOptions defines the available page size options shown to the user. + +For example: listPageSizeOptions: [10, 20, 50] will allow switching between 10 / 20 / 50 records per page. + +#### UI behavior +Page size switching is implemented via a select dropdown (select input) in the table pagination controls. +- User opens the select +- Chooses a value (e.g. 20) +- Table reloads with the new page size +> ☝️Notes +If listPageSizeOptions is not provided, a default set of page sizes will be used. The selected value updates the table immediately and triggers a data refetch. This option works together with listPageSize, which defines both the default value and the available options at the same time. + ### Virtual scroll Set `options.listVirtualScrollEnabled` to true to enable virtual scrolling in the table. The default value is false. Enable this option if you need to display a large number of records on a single page. diff --git a/adminforth/spa/src/components/ResourceListTable.vue b/adminforth/spa/src/components/ResourceListTable.vue index df90cafc2..d3b3b91a3 100644 --- a/adminforth/spa/src/components/ResourceListTable.vue +++ b/adminforth/spa/src/components/ResourceListTable.vue @@ -340,6 +340,20 @@ +
+ + {{ $t('Rows per page') }} + +