spatie / vue-table-component

A straight to the point Vue component to display tables
http://vue-table-component.spatie.be
MIT License
588 stars 149 forks source link

Adding class to cell based on row data #159

Closed McMaNGOS closed 6 years ago

McMaNGOS commented 6 years ago

I'd like to have different classes added to td elements based on what they contain (if the text in the cell is "hello", this would result in class="hello", for example). I thought I could use <template> to achieve this, but I can't seem to figure it out.

The closest thing I've gotten is:

<table-column show="name" label="Name">
  <template slot-scope="row">
    <td v-bind:class="{[row.name]: row.name}">{{row.name}}</td>
  </template>
</table-column>

Which adds another td element within the td element, with a class matching the current row's name value. But how can I add this class to the outer td element?

spatie-bot commented 6 years ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.