Ask Your Question
4

What steps can be taken to turn off the ability to scroll horizontally in a Vuetify DataTable?

asked 2023-05-02 13:11:17 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-05-02 13:34:02 +0000

devzero gravatar image
  1. Set the fixed-layout property to true:
<v-data-table
  :headers="headers"
  :items="items"
  fixed-layout
>
</v-data-table>
  1. Set the hide-default-header or hide-default-footer property, if applicable:
<v-data-table
  :headers="headers"
  :items="items"
  fixed-layout
  hide-default-header
>
</v-data-table>
  1. Specify the width of the table or columns:
<v-data-table
  :headers="headers"
  :items="items"
  fixed-layout
  hide-default-header
  :width="500"
>
  <template v-slot:[`header-cell`]="{ item }">
    <v-tooltip bottom>
      <span>{{ item.text }}</span>
      <span slot="activator">
        <v-icon small>mdi-sort</v-icon>
      </span>
    </v-tooltip>
  </template>
  <template v-slot:[`item.action`]="{ item }">
    <v-icon small @click="deleteItem(item.id)">mdi-delete</v-icon>
  </template>
  <template #no-data>
    <v-alert :value="true" color="error" icon="mdi-alert-circle-outline">
      Sorry, nothing here.
    </v-alert>
  </template>
</v-data-table>
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-02 13:11:17 +0000

Seen: 9 times

Last updated: May 02 '23