Skip to content

Commit 710445f

Browse files
committed
feat: add listBufferSize prop to virtual table
1 parent c172a2a commit 710445f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

adminforth/documentation/docs/tutorial/03-Customization/13-standardPagesTuning.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,20 @@ export default {
151151
}
152152
]
153153
```
154+
Additionally, you can configure `options.listBufferSize` to specify the number of rows to buffer for virtual scrolling. The default value is 30 rows.
155+
156+
```typescript title="./resources/apartments.ts"
157+
export default {
158+
resourceId: 'aparts',
159+
options: {
160+
...
161+
listVirtualScrollEnabled: true,
162+
//diff-add
163+
listBufferSize: 20,
164+
}
165+
}
166+
]
167+
```
154168

155169
### Custom row click action
156170

adminforth/spa/src/views/ListView.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
:tableBodyStartInjection="coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart"
124124
:container-height="1100"
125125
:item-height="52.5"
126-
:buffer-size="30"
126+
:buffer-size="listBufferSize"
127127
/>
128128
<ResourceListTable
129129
v-else
@@ -202,6 +202,7 @@ const DEFAULT_PAGE_SIZE = 10;
202202
203203
const pageSize = computed(() => coreStore.resource?.options?.listPageSize || DEFAULT_PAGE_SIZE);
204204
const isVirtualScrollEnabled = computed(() => coreStore.resource?.options?.listVirtualScrollEnabled || false);
205+
const listBufferSize = computed(() => coreStore.resource?.options?.listBufferSize || 30);
205206
206207
const isPageLoaded = ref(false);
207208

adminforth/types/Common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@ export interface AdminForthResourceInputCommon {
399399
*/
400400
listVirtualScrollEnabled?: boolean,
401401

402+
/**
403+
* Buffer size for virtual scroll in list view.
404+
*/
405+
listBufferSize?: number,
406+
402407
/**
403408
* Callback to define what happens when user clicks on record in list view.
404409
* By default show view will be opened.

0 commit comments

Comments
 (0)