You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/03-Customization/13-standardPagesTuning.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -319,6 +319,48 @@ export default {
319
319
]
320
320
```
321
321
322
+
### List Page Size Options
323
+
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.
324
+
```typescript title="./resources/apartments.ts"
325
+
exportdefault {
326
+
resourceId: 'aparts',
327
+
options: {
328
+
...
329
+
listPageSize: 10,
330
+
// listPageSizeOptions can be a static array
331
+
//diff-add
332
+
listPageSizeOptions: [10, 20, 50],
333
+
// OR a function for dynamic options based on user role
334
+
//diff-add
335
+
listPageSizeOptions: ({ adminUser }) => {
336
+
//diff-add
337
+
if (adminUser?.dbUser?.role==='superadmin') {
338
+
//diff-add
339
+
return [50, 100, 500];
340
+
//diff-add
341
+
}
342
+
//diff-add
343
+
return [10, 20, 50];
344
+
//diff-add
345
+
},
346
+
}
347
+
}
348
+
]
349
+
```
350
+
#### How it works
351
+
- listPageSize defines the default number of records per page when the list is opened.
352
+
- listPageSizeOptions defines the available page size options shown to the user.
353
+
354
+
For example: listPageSizeOptions: [10, 20, 50] will allow switching between 10 / 20 / 50 records per page.
355
+
356
+
#### UI behavior
357
+
Page size switching is implemented via a select dropdown (select input) in the table pagination controls.
358
+
- User opens the select
359
+
- Chooses a value (e.g. 20)
360
+
- Table reloads with the new page size
361
+
> ☝️Notes
362
+
If `listPageSizeOptions` is not provided (or resolves to an empty array), the page size select is not shown. The selected value updates the table immediately and triggers a data refetch. Use `listPageSize` to define the initial number of records per page, and `listPageSizeOptions` to define which page sizes the user can switch between.
363
+
322
364
### Virtual scroll
323
365
324
366
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.
0 commit comments