|
63 | 63 | <SkeleteLoader |
64 | 64 | v-if="!rows" |
65 | 65 | :columns="resource?.columns.filter(c => c.showIn.list).length + 2" |
66 | | - :rows="3" |
| 66 | + :rows="rowHeights.length || 3" |
| 67 | + :row-heights="rowHeights" |
67 | 68 | /> |
68 | 69 | <tr v-else-if="rows.length === 0" class="bg-lightListTable dark:bg-darkListTable dark:border-darkListTableBorder"> |
69 | 70 | <td :colspan="resource?.columns.length + 2"> |
|
80 | 81 |
|
81 | 82 | <tr @click="onClick($event,row)" |
82 | 83 | v-else v-for="(row, rowI) in rows" :key="`row_${row._primaryKeyValue}`" |
| 84 | + ref="rowRefs" |
83 | 85 | class="bg-lightListTable dark:bg-darkListTable border-lightListBorder dark:border-gray-700 hover:bg-lightListTableRowHover dark:hover:bg-darkListTableRowHover" |
84 | 86 |
|
85 | 87 | :class="{'border-b': rowI !== rows.length - 1, 'cursor-pointer': row._clickUrl !== null}" |
|
269 | 271 | <script setup lang="ts"> |
270 | 272 |
|
271 | 273 |
|
272 | | -import { computed, onMounted, ref, watch, type Ref } from 'vue'; |
| 274 | +import { computed, onMounted, ref, watch, useTemplateRef, type Ref } from 'vue'; |
273 | 275 | import { callAdminForthApi } from '@/utils'; |
274 | 276 | import { useI18n } from 'vue-i18n'; |
275 | 277 | import ValueRenderer from '@/components/ValueRenderer.vue'; |
@@ -347,6 +349,13 @@ watch(() => props.page, (newPage) => { |
347 | 349 | page.value = newPage; |
348 | 350 | }); |
349 | 351 |
|
| 352 | +const rowRefs = useTemplateRef('rowRefs'); |
| 353 | +const rowHeights = ref([]); |
| 354 | +watch(() => props.rows, (newRows) => { |
| 355 | + // rows are set to null when new records are loading |
| 356 | + rowHeights.value = newRows ? [] : rowRefs.value.map((el) => el.offsetHeight); |
| 357 | +}); |
| 358 | +
|
350 | 359 | function addToCheckedValues(id) { |
351 | 360 | if (checkboxesInternal.value.includes(id)) { |
352 | 361 | checkboxesInternal.value = checkboxesInternal.value.filter((item) => item !== id); |
|
0 commit comments