Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

411
Views
Is it possible to programmatically hide Vuetify data-table items?

I'm wondering if there is a way to hide a whole row/item in a vuetify data-table. I've read threads about hiding columns but not data-table items.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

As per my understanding, You want to hide the specific rows from the <v-data-table>. If Yes, you can achieve that by using v-slot and manipulate the template.

Demo :

new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  data () {
    return {
      headers: [
        {
          text: 'Dessert',
          value: 'name'
        }
      ],
      items: [
        {
          name: 'Frozen Yogurt',
          show: true
        },
        {
          name: 'Ice cream sandwich',
          show: false
        },
        {
          name: 'Eclair',
          show: true
        },
        {
          name: 'Cupcake',
          show: false
        }
      ]
    }
  },
})
<script src="https://unpkg.com/vue@2.x/dist/vue.js"></script>
<script src="https://unpkg.com/vuetify@2.6.6/dist/vuetify.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/vuetify@2.6.6/dist/vuetify.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/@mdi/font@6.x/css/materialdesignicons.min.css"/>
<div id="app">
  <v-app id="inspire">
    <v-data-table
      :headers="headers"
      :items="items"
      class="elevation-1"
    >
      <template v-slot:item="props">
    <template v-if="props.item.show">
      <tr>{{ props.item.name }}</tr>
    </template>
</template>
    </v-data-table>
  </v-app>
</div>

about 4 years ago · Juan Pablo Isaza Report

0

I think passing an empty array to your :items would fix your problem. or you can do this one :items="defaultVales || desserts".

about 4 years ago · Juan Pablo Isaza Report

0

In my opinion, the best way to handle this is to add a show property to your objects and use a computed property to hide and show items

Working example

Here it will hide column on click

new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  computed:{
    showItems(){
      return this.desserts.filter(x => x.show)
    }
  },
  data() {
    return {
      headers: [
        { text: 'Name', value: 'name' },
        { text: 'Score', value: 'score' },
      ],
      desserts: [{
          name: "Frozen",
          score: 66,
          show: true,
        },
        {
          name: "Tom",
          score: 100,
          show: true,
        },
        {
          name: "Eclair",
          score: 100,
          show: true,
        },
        {
          name: "Frozen",
          score: 89,
          show: true,
        },
      ]
    }
  },
  
  methods: {
    hideColumn(col){
      col.show = false
    }
  }
})
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/vuetify@2.3.4/dist/vuetify.min.css'>
<script src='https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js'></script>
<script src='https://cdn.jsdelivr.net/npm/vuetify@2.3.4/dist/vuetify.min.js'></script>

<div id="app">
  <v-data-table
    :items="showItems"
    :headers="headers"
    @click:row="hideColumn"
  >
  
  </v-data-table>
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!