I've created a global components extending Bootstrap Vue Table component to made a custom template for each table named VTable
.
The Bootstrap Vue Table component have possibility to use named slots to customize the data rendering.
<template>
<div>
<b-table
:items="items"
:fields="fields"
...
>
</b-table>
</div>
</template>
<script>
import Table from 'bootstrap-vue/es/components/table/table';
export default {
name: 'Vtable',
extends: Table,
...
};
</script>
I use the global table component inside another one using the new custom HTML tag.
<v-table
v-if="items"
:items="items"
:fields="fields"
...
>
<template
slot="timestamp"
slot-scope="data"
>
...
</template>
<template
slot="row-details"
slot-scope="row"
>
...
</template>
</v-table>
The problem is that the named slots used in the VTable
component are not displayed inside the child component.
I also tried to create a custom named slot inside the global component
<template>
<div>
<b-table
...
>
<slot name="customRendering"/>
</b-table>
</div>
</template>
And use it like
<v-table
...
>
<template slot="customRendering">
<template
slot="timestamp"
slot-scope="data"
>
...
</template>
<template
slot="row-details"
slot-scope="row"
>
...
</template>
</template>
</v-table>
Without success
This is possible to simply use named slots defined inside grand-child component or does it totally not possible ?
I also think to loop through customRendering
slot value to recreated dynamically the Bootstrap Vue table slots.