I am using VueJs with Bootstrap. With the current code I can only select a whole row. Is it possible to select one or multiple table cells?
Hope you can help me!
<template>
<div class="scheduler">
<b-table ref="selectableTable"
selectable
:items="scheduleMap"
:fields="fields">
</b-table>
</div>
</template>
<script>
export default {
name: 'Scheduler',
data() {
return {
fields: ['time', 'bookedCourt1', 'bookedCourt2'],
scheduleMap: [
{time: "9:00 AM", bookedCourt1: true, bookedCourt2: false},
{time: "10:00 AM", bookedCourt1: false, bookedCourt2: true},
{time: "11:00 AM", bookedCourt1: false, bookedCourt2: true},
],
}
}
}
</script>
Unfortunately this isn't possible. As you probably saw you can only select whole row https://bootstrap-vue.org/docs/components/table#row-select-support.
But you can pass a custom cell to a table. For example:
Working sample: https://codesandbox.io/s/vigilant-leakey-dknvx