Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify, v-data-table headers value purpose

What is the purpose of the value property in headers array of objects for v-data-table?

In the documentation it says

An array of objects that each describe a header column. See the example below for a definition of all properties.

{
  text: string",
  value: string",
  align: 'left' | 'center' | 'right'",
  sortable: boolean",
  class: string[] | string",
  width: string"
}

But it never actually explains the purpose of it.

Does the header object just need a unique key or can I can someone use that value in the html?

like image 697
theblindprophet Avatar asked Apr 21 '26 05:04

theblindprophet


1 Answers

When you define that column as sortable: true, it is the value, and not the text, that will be set on the pagination object.

For instance, my column is called Created at (text), and it's value is created_at. This allows me to watch the pagination object, and send the order by data directly without an extra mapping step, as my API expects the value of orderBy to be either created_at or nothing.

like image 182
Borjante Avatar answered Apr 23 '26 22:04

Borjante



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!