Clark
Clark

Reputation: 2213

Warning in the console output when using the Vuetify v-data-table component

I am using the Vuetify v-data-table component. Here it is:

<template>
  <div>
    <v-data-table
      :headers="tableHeaders"
      :items="items"
      hide-actions
      class="elevation-1"
    >
      <template slot="items" slot-scope="props">
        <td>{{ props.item.name }}</td>
        <td>{{ props.item.created_at }}</td>
        <td>{{ props.item.updated_at }}</td>
      </template>
    </v-data-table>
    <AddPlanButton/>
  </div>
</template>

Here are my headers:

data () {
  return {
    items: [],
    tableHeaders: [
      { text: 'Name' },
      { text: 'Created at' },
      { text: 'Updated at' }
    ]
  }
},

And I am getting the next warning in the console:

[Vuetify] Headers must have a value property that corresponds to a value in the v-model array in "v-data-table"

I can translate but I can not understand exactly - what should I do in my code?

Upvotes: 1

Views: 3315

Answers (2)

cetor007
cetor007

Reputation: 1

Here is a issue, for replicate go in: https://codepen.io/cetor007/pen/mxexWp?editors=1011

the issue happens, in this case. items[]-> requered an attribute with name (name) and if name have the same (value) selected all values that have same value.

Upvotes: 0

ndpu
ndpu

Reputation: 22571

Just as warning message says: headers must have a value property (key name in items objects list):

tableHeaders: [
  { text: 'Name', value: 'name_key_name' },
  { text: 'Created at', value: 'created_key_name' },
  { text: 'Updated at', value: 'updated_key_name' }
]

Upvotes: 6

Related Questions