Can I apply different styling for a specific row in a data table?
This is my code:
You can now use vuetifys data table item-class property:
new Vue({
el: '#app',
vuetify: new Vuetify(),
methods: {
row_classes(item) {
if (item.calories < 200) {
return "orange"; //can also return multiple classes e.g ["orange","disabled"]
}
}
},
data () {
return {
singleSelect: false,
selected: [],
headers: [{text: 'Dessert (100g serving)', value: 'name'},
{ text: 'Calories', value: 'calories' },
],
desserts: [{name: 'Frozen Yogurt',calories: 159,},
{name: 'Ice cream sandwich',calories: 237,},
{name: 'Eclair',calories: 262,},
{name: 'Cupcake',calories: 305,},
],
}
},
})
.orange {
background-color: orange;
}