File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1203,6 +1203,9 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
12031203 ) ,
12041204 options : {
12051205 ...resource . options ,
1206+ listPageSizeOptions : typeof resource . options . listPageSizeOptions === 'function'
1207+ ? await resource . options . listPageSizeOptions ( { adminUser, adminforth : this . adminforth } )
1208+ : resource . options . listPageSizeOptions ,
12061209 fieldGroups : resource . options . fieldGroups ?. map ( ( group , i ) => ( {
12071210 ...group ,
12081211 noTitle : group . noTitle ?? false ,
Original file line number Diff line number Diff line change @@ -262,6 +262,13 @@ const customActionLoadingStates = ref<{[key: string]: boolean}>({});
262262
263263const DEFAULT_PAGE_SIZE = 10 ;
264264
265+ watch (() => coreStore .resource ?.resourceId , () => {
266+ if (coreStore .resource ?.options ?.listPageSize ) {
267+ pageSize .value = coreStore .resource .options .listPageSize ;
268+ } else {
269+ pageSize .value = DEFAULT_PAGE_SIZE ;
270+ }
271+ });
265272
266273const PAGE_SIZE_OPTIONS = computed (() => {
267274 const array = coreStore .resource ?.options ?.listPageSizeOptions ;
Original file line number Diff line number Diff line change @@ -472,7 +472,7 @@ export interface AdminForthResourceInputCommon {
472472 * Page size for list view
473473 */
474474 listPageSize ?: number ,
475- listPageSizeOptions ?: number [ ] ,
475+ listPageSizeOptions ?: number [ ] | ( ( args : { adminUser : any , adminforth : any } ) => number [ ] | Promise < number [ ] > ) ;
476476
477477 /**
478478 * Whether to use virtual scroll in list view.
You can’t perform that action at this time.
0 commit comments