1

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?

2 Answers 2

6

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' }
]
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.