JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://unpkg.com/vuetify/dist/vuetify.min.css">
<script src="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vuetify/dist/vuetify.js"></script>
<div id="app">
<v-app>
<main>
<data-table></data-table>
</main>
</v-app>
</div>
<template id="data-table">
<v-data-table v-bind:headers="headers" :items="items" class="elevation-1">
<template slot="headerCell" scope="props">
<span v-tooltip:bottom="{ 'html': props.header.text }">
{{ props.header.text }}
</span>
</template>
<template slot="items" scope="props">
<td>{{ props.item.name }}</td>
<td class="text-xs-right" @click="onCaloriesClick(props)">
{{ props.item.calories }}
</td>
<td class="text-xs-right">{{ props.item.fat }}</td>
<td class="text-xs-right">{{ props.item.carbs }}</td>
<td class="text-xs-right">{{ props.item.protein }}</td>
<td class="text-xs-right">{{ props.item.sodium }}</td>
<td class="text-xs-right">{{ props.item.calcium }}</td>
<td class="text-xs-right">{{ props.item.iron }}</td>
</template>
</v-data-table>
</template>
JavaScript
var DataTableComponent = {
template: '#data-table',
methods: {
onCaloriesClick: function (props) {
console.dir(props)
}
},
data() {
return {
headers: [{
text: 'Dessert (100g serving)',
align: 'left',
sortable: false,
value: 'name'
}, {
text: 'Calories',
value: 'calories'
}, {
text: 'Fat (g)',
value: 'fat'
}, {
text: 'Carbs (g)',
value: 'carbs'
}, {
text: 'Protein (g)',
value: 'protein'
}, {
text: 'Sodium (mg)',
value: 'sodium'
}, {
text: 'Calcium (%)',
value: 'calcium'
}, {
text: 'Iron (%)',
value: 'iron'
}],
items: [{
value: false,
name: 'Frozen Yogurt',
calories: 159,
fat: 6.0,
carbs: 24,
protein: 4.0,
sodium: 87,
calcium: '14%',
iron: '1%'
}, {
value: false,
name: 'Ice cream sandwich',
calories: 237,
fat: 9.0,
carbs: 37,
protein: 4.3,
sodium: 129,
calcium: '8%',
iron: '1%'
}, {
value: false,
name: 'Eclair',
calories: 262,
fat: 16.0,
carbs: 23,
protein: 6.0,
sodium: 337,
calcium: '6%',
iron: '7%'
}, {
value: false,
name: 'Cupcake',
calories: 305,
fat: 3.7,
carbs: 67,
protein: 4.3,
sodium: 413,
calcium: '3%',
iron: '8%'
}, {
value: false,
name: 'Gingerbread',
calories: 356,
fat: 16.0,
carbs: 49,
protein: 3.9,
sodium: 327,
calcium: '7%',
iron: '16%'
}, {
value: false,
name: 'Jelly bean',
calories: 375,
fat: 0.0,
carbs: 94,
protein: 0.0,
sodium: 50,
calcium: '0%',
iron: '0%'
}, {
...