vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

[Feature Request] Allow deeper templating for rows in v-data-table

Open archeg opened this issue 7 years ago • 1 comments

Problem to solve

Would be nice to template out <tr/> for each row, but still continue to use #item.<field> templates as well.

My use case: I have a huge table where I use #item.<field> templates a lot. They are nice and I'd like to continue to use them. But I need to be able to set a different background color for each <tr/>. If I use the current template as implemented #item - it replaces the whole <tr/> with all the contents, so I have to write all the cells myself now.

Proposed solution

Would be nice to be able to use cell component inside #item (maybe it is even possible right now? if that's the case, it needs to be added to documentation). For example to illustrate:

<template #item="{item, headers}">
   <tr v-if="item.IsOffline">
      <v-table-cell :header="header" v-for="header in headers">
   </tr>
   <tr v-else style="background-color: red">
      <td>There item is offline</td>
  </tr>
</template

If item.HasData we receive a normal behavior for the table, that will use all the other templates like #item.<field>. If !item.HasData it will render a totally another <tr> with custom functionality

archeg avatar Nov 18 '19 18:11 archeg

Duplicate of https://github.com/vuetifyjs/vuetify/issues/8643

jacekkarczmarczyk avatar Jan 11 '20 11:01 jacekkarczmarczyk