Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can hide row 'no-data' in datatable Vuetify

Tags:

vuetify.js

I'm beginner in vue and vuetify. I'm trying to make the first application on vue and vuetify. I'd like customize data table in vuetify. It has row 'no-data' default (with text 'No data available'). I want hide this row, but data table has no option such as 'hide-no-data'.

like image 305
Dmitriy G Avatar asked Sep 19 '18 08:09

Dmitriy G


3 Answers

You can override the no-data slot. Here is how it looks in the documentation:

</v-data-table>    
 <template slot="no-data">
   <v-alert :value="true" color="error" icon="warning">
     Sorry, nothing to display here :(
   </v-alert>
 </template>
</v-data-table>

All you would have to do is replace the v-alert with an empty div

<template slot="no-data">
  <div></div>
</template>
like image 99
jordanw Avatar answered Nov 11 '22 18:11

jordanw


enter image description here

<v-data-table>
    <template v-slot:no-data>
      <v-alert :value="true" color="error" icon="warning">
        Sorry, nothing to display here :(
      </v-alert>
    </template>
<v-data-table>
like image 25
wDrik Avatar answered Nov 11 '22 19:11

wDrik


A bit late but it might still help someone..

You can use an empty row and hide it by setting visibility to hidden:

<v-data-table ref="myTable">
    <template slot="no-data">
        <tr style="visibility: hidden;" />
    </template>
    ....
</v-data-table>

Or if you want the entire content gone you can remove it manually by code:

$refs.myTable.$el.getElementsByTagName('tbody')[0].innerHTML = '';

Where myTable refers to the v-data-table.

like image 2
Arno van Oordt Avatar answered Nov 11 '22 18:11

Arno van Oordt