M
M
Mat1lda2020-08-06 19:28:01
Vue.js
Mat1lda, 2020-08-06 19:28:01

Vuetify: Is there a way to change the state of a row in a v-data-table natively?

Actually the question is: is it possible to change the color of the line and make the checkbox inactive (show-select) by regular means, or do I need to redefine the entire line manually?

Example: let's say I'm drawing a table in which id and name, you need to change the color of the line for all id multiples of 3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-08-06
@Mat1lda

Use the parameter item-class. Can be a function that takes an object with string data and returns classes:

<v-data-table
  :item-class="itemClasses"
  ...

methods: {
  itemClasses: item => ({
    red: !(item.id % 3),
  }),
  ...
},

.red {
  background: red;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question