Fixed #2756 - Add getVirtualScrollerRef method to DataTable to access virtualScroller's reference

pull/2760/head
mertsincan 2022-07-04 10:25:28 +01:00
parent cd8b59bd16
commit 6898e45c6f
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,7 @@
</template>
</DTPaginator>
<div class="p-datatable-wrapper" :style="{ maxHeight: virtualScrollerDisabled ? scrollHeight : '' }">
<DTVirtualScroller v-bind="virtualScrollerOptions" :items="processedData" :columns="columns" :style="{ height: scrollHeight }" :disabled="virtualScrollerDisabled" loaderDisabled :showSpacer="false">
<DTVirtualScroller ref="virtualScroller" v-bind="virtualScrollerOptions" :items="processedData" :columns="columns" :style="{ height: scrollHeight }" :disabled="virtualScrollerDisabled" loaderDisabled :showSpacer="false">
<template #content="slotProps">
<table ref="table" role="table" :class="[tableClass, 'p-datatable-table']" :style="[tableStyle, slotProps.spacerStyle]">
<DTTableHeader :columnGroup="headerColumnGroup" :columns="slotProps.columns" :rowGroupMode="rowGroupMode"
@ -1780,6 +1780,9 @@ export default {
}
return _data;
},
getVirtualScrollerRef() {
return this.$refs.virtualScroller;
}
},
computed: {