Skip to content

Commit

Permalink
Checkbox Table allows custom template for checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifilote committed Oct 14, 2021
1 parent 889962c commit 2ba446e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/components/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,20 @@
@click.stop="onCheckboxClicked(row, index, $event)"
class="vgt-checkbox-col"
>
<template
v-if="hasCheckboxColumnTemplate"
slot="table-checkbox-column"
slot-scope="props"
>
<slot
name="table-checkbox-column"
:row="props.row"
>
</slot>
</template>

<input
v-else
type="checkbox"
:disabled="row.vgtDisabled"
:checked="row.vgtSelected"
Expand Down Expand Up @@ -603,6 +616,13 @@ export default {
);
},
hasCheckboxColumnTemplate(){
return (
!!this.$slots['table-checkbox-column'] ||
!!this.$scopedSlots['table-checkbox-column']
);
}
showEmptySlot() {
if (!this.paginated.length) return true;
Expand Down Expand Up @@ -849,7 +869,7 @@ export default {
const column = this.getColumnForField(srt.field);
const xvalue = this.collect(xRow, srt.field);
const yvalue = this.collect(yRow, srt.field);
//* if a custom sort function has been provided we use that
const { sortFn } = column;
if (sortFn && typeof sortFn === 'function') {
Expand Down

0 comments on commit 2ba446e

Please sign in to comment.