Vuetify: [Feature Request] Change the cursor to pointer when click:row event is attached in VDataTable

Created on 8 Apr 2020  路  6Comments  路  Source: vuetifyjs/vuetify

Problem to solve

When a user currently hover over a table row and the row has a click event attached to it, the user will only recognize that there is an action, when he know the functionallity or clicked the row by accident.

There should be any visual change for the user, to let him know there is some action he can trigger.

Proposed solution

Check if the 'click:row' event is attached to the component and add a class while generate the Row element, which change the cursor to pointer.

Can be done by extending the genDefaultSimpleRow function in VDataTable

class: {
    ...classes,
    'v-data-table__selected': data.isSelected,
    'v-clickable': this.$listeners && this.$listeners['click:row'],
},
.v-clickable { cursor: pointer; }
VDataTable feature

Most helpful comment

https://stackoverflow.com/a/61792596
The above code didn't work for me

  • Vuetify v2.3.2
/* <v-data-table class="table-cursor"></v-data-table> */
.table-cursor tbody tr:hover {
  cursor: pointer;
}

I solved it with this code.

All 6 comments

Until this is implemented: Does anyone have a nice workaround?

Until this is implemented: Does anyone have a nice workaround?

I'm wondering about a workaround too!!

since click:row applies for each row you can just apply cursor:pointer style to table>tbody>tr

since click:row applies for each row you can just apply cursor:pointer style to table>tbody>tr

This was my first guess, but it doesn't work.

Ohh man the problem is that I was using scoped css! My bad, it really works!

https://stackoverflow.com/a/61792596
The above code didn't work for me

  • Vuetify v2.3.2
/* <v-data-table class="table-cursor"></v-data-table> */
.table-cursor tbody tr:hover {
  cursor: pointer;
}

I solved it with this code.

Was this page helpful?
0 / 5 - 0 ratings