|
18 | 18 | <!-- table header --> |
19 | 19 | <tr class="t-header sticky z-10 top-0 text-xs bg-lightListTableHeading dark:bg-darkListTableHeading dark:text-gray-400"> |
20 | 20 | <td scope="col" class="p-4"> |
21 | | - <div v-if="rows && rows.length" class="flex items-center"> |
| 21 | + <div class="flex items-center"> |
22 | 22 | <input id="checkbox-all-search" type="checkbox" :checked="allFromThisPageChecked" @change="selectAll()" |
| 23 | + :disabled="!rows || !rows.length" |
23 | 24 | class="w-4 h-4 cursor-pointer text-blue-600 bg-gray-100 border-gray-300 rounded |
24 | 25 | focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"> |
25 | 26 | <label for="checkbox-all-search" class="sr-only">{{ $t('checkbox') }}</label> |
26 | 27 | </div> |
27 | 28 | </td> |
28 | 29 |
|
29 | | - <td v-for="c in columnsListed" scope="col" class="px-2 md:px-3 lg:px-6 py-3"> |
| 30 | + <td v-for="c in columnsListed" ref="headerRefs" scope="col" class="px-2 md:px-3 lg:px-6 py-3"> |
30 | 31 |
|
31 | 32 | <div @click="(evt) => c.sortable && onSortButtonClick(evt, c.name)" |
32 | 33 | class="flex items-center " :class="{'cursor-pointer':c.sortable}"> |
|
65 | 66 | :columns="resource?.columns.filter(c => c.showIn.list).length + 2" |
66 | 67 | :rows="rowHeights.length || 3" |
67 | 68 | :row-heights="rowHeights" |
| 69 | + :column-widths="columnWidths" |
68 | 70 | /> |
69 | 71 | <tr v-else-if="rows.length === 0" class="bg-lightListTable dark:bg-darkListTable dark:border-darkListTableBorder"> |
70 | 72 | <td :colspan="resource?.columns.length + 2"> |
@@ -376,10 +378,13 @@ watch(() => props.page, (newPage) => { |
376 | 378 | }); |
377 | 379 |
|
378 | 380 | const rowRefs = useTemplateRef('rowRefs'); |
| 381 | +const headerRefs = useTemplateRef('headerRefs'); |
379 | 382 | const rowHeights = ref([]); |
| 383 | +const columnWidths = ref([]); |
380 | 384 | watch(() => props.rows, (newRows) => { |
381 | 385 | // rows are set to null when new records are loading |
382 | 386 | rowHeights.value = newRows || !rowRefs.value ? [] : rowRefs.value.map((el) => el.offsetHeight); |
| 387 | + columnWidths.value = newRows || !headerRefs.value ? [] : [48, ...headerRefs.value.map((el) => el.offsetWidth)]; |
383 | 388 | }); |
384 | 389 |
|
385 | 390 | function addToCheckedValues(id) { |
|
0 commit comments