Skip to content Skip to sidebar Skip to footer

How To Clear Selected Row In V-data-table, Vuetify

I have a Vue app where I'm using v-data-table with show-select option. I want to clear only selected data using the 'cancel' button. Already I can clear all data from the table onc

Solution 1:

If you just want to deselect them:

cancel() {
   this.selected = [];
}

If you want to remove them:

cancel() {
  this.desserts = this.desserts.filter(item => {
    returnthis.selected.indexOf(item) < 0;
  });
}

Keep in mind that this array subtraction algorithm is O(n^2) complexity, so for large datasets this may be slow. In that case, you can use a more robust algorithm

Post a Comment for "How To Clear Selected Row In V-data-table, Vuetify"