Skip to content

Commit 2ba446e

Browse files
committed
Checkbox Table allows custom template for checkbox
1 parent 889962c commit 2ba446e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/components/Table.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,20 @@
236236
@click.stop="onCheckboxClicked(row, index, $event)"
237237
class="vgt-checkbox-col"
238238
>
239+
<template
240+
v-if="hasCheckboxColumnTemplate"
241+
slot="table-checkbox-column"
242+
slot-scope="props"
243+
>
244+
<slot
245+
name="table-checkbox-column"
246+
:row="props.row"
247+
>
248+
</slot>
249+
</template>
250+
239251
<input
252+
v-else
240253
type="checkbox"
241254
:disabled="row.vgtDisabled"
242255
:checked="row.vgtSelected"
@@ -603,6 +616,13 @@ export default {
603616
);
604617
},
605618
619+
hasCheckboxColumnTemplate(){
620+
return (
621+
!!this.$slots['table-checkbox-column'] ||
622+
!!this.$scopedSlots['table-checkbox-column']
623+
);
624+
}
625+
606626
showEmptySlot() {
607627
if (!this.paginated.length) return true;
608628
@@ -849,7 +869,7 @@ export default {
849869
const column = this.getColumnForField(srt.field);
850870
const xvalue = this.collect(xRow, srt.field);
851871
const yvalue = this.collect(yRow, srt.field);
852-
872+
853873
//* if a custom sort function has been provided we use that
854874
const { sortFn } = column;
855875
if (sortFn && typeof sortFn === 'function') {

0 commit comments

Comments
 (0)