Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to hide bootstrap-vue table header row

bootstrap-vue will by default create a header row for my data. Is there any way to hide the header row for a <b-table> so only data items will be rendered?

like image 243
It-Z Avatar asked Apr 15 '18 14:04

It-Z


People also ask

How to hide the header row in Bootstrap?

you could simply use "bootstrap magic" and add thead-class="d-none" to hide the header row: <template> <b-table :items="items" thead-class="d-none" /> </template>

How to create cell headings in Bootstrap Vue?

Specifically, BootstrapVue uses a special data attribute to create the cell's heading, of which you can supply to <b-td> or <b-th> via the stacked-heading prop. Only plain strings are supported (not HTML markup), as we use the pseudo element ::before and css content property.

How to support stacked tables in bootstrapvue?

In an always stacked table, the table header and footer, and the fixed top and bottom row slots will not be rendered. BootstrapVue's custom CSS is required in order to support stacked tables.

How to support sticky columns in Bootstrap Vue?

BootstrapVue's custom CSS is required in order to support sticky columns. The sticky column feature uses CSS style position: sticky to position the column cells. Internet Explorer does not support position: sticky, hence for IE 11 the sticky column will scroll with the table body. Row details support


1 Answers

From the documentation here, there is an option to set the class for the header (i.e the generated <thead>) with thead-class set to the <b-table> element, or to the header row (i.e the <tr> element under the <thead>) with thead-tr-class set to the <b-table>. Only note that is the <style> is scoped this will not work. Here is a simple component based on this idea.

<template>
  <b-table :items="items" thead-class="hidden_header"/>
</template>

<script>

export default {
  name: 'my-table',
  props: {
    items: {
      type: Array,
      required: true
    }
  }
}
</script>

<!-- If we add "scoped" attribute to limit CSS to this component only 
     the hide of the header will not work! -->
<style scoped>
    <!-- put scoped CSS here -->
</style>
<style>
.hidden_header {
  display: none;
}
</style>
like image 153
It-Z Avatar answered Oct 06 '22 07:10

It-Z