DEV Community

Rajasekar Thangavel
Rajasekar Thangavel

Posted on • Updated on

Select all table rows from the table not only current page in vuetify 2.x

Select all table rows in all pages

  • Add @toggle-select-all="selectAll" in table
  <v-data-table v-model="selectedTasks" :headers="headers" 
:items="tasks" item-key="id" show-select 
:toggle-select-all="selectAll">

</v-data-table>
Enter fullscreen mode Exit fullscreen mode
selectAll(event) {
    if (event.value === true) {
        this.selectedTasks = [...this.tasks];
    } else {
        this.selectedTasks = [];
    }
}
Enter fullscreen mode Exit fullscreen mode

Working example - https://jsfiddle.net/ktrajasekar/8nqu64f9

Top comments (0)