Skip to content

fix(VDataTable): respect disableSort prop for sortable header#22684

Merged
J-Sek merged 1 commit intovuetifyjs:masterfrom
SonTT19:fix/22523-v-datatable-sortable-header
Mar 8, 2026
Merged

fix(VDataTable): respect disableSort prop for sortable header#22684
J-Sek merged 1 commit intovuetifyjs:masterfrom
SonTT19:fix/22523-v-datatable-sortable-header

Conversation

@SonTT19
Copy link
Copy Markdown
Contributor

@SonTT19 SonTT19 commented Mar 5, 2026

Description

fixes #22523

Markup:

<template>
  <v-data-table
    :headers="headers"
    :items="items"
    item-key="name"
    disable-sort
    hide-default-footer
    @update:sort-by="(v) => sortBy = v"
  />

  <div class="mt-8">Sort by: {{ sortBy }}</div>
</template>

<script setup>
  import { ref } from 'vue';

  const sortBy = ref(null);

  const headers = [
    {
      title: 'Pyramid',
      value: 'name',
      sortable: true,
    },
    {
      title: 'Location',
      value: 'location',
      sortable: true,
    },
    {
      title: 'Construction Date',
      value: 'constructionDate',
      sortable: true,
    },
  ]

  const items = [
    {
      name: 'Great Pyramid of Giza',
      location: 'Egypt',
      height: '146.6',
      base: '230.4',
      volume: '2583285',
      constructionDate: 'c. 2580–2560 BC',
    },
    {
      name: 'Pyramid of Khafre',
      location: 'Egypt',
      height: '136.4',
      base: '215.3',
      volume: '1477485',
      constructionDate: 'c. 2570 BC',
    },
    {
      name: 'Red Pyramid',
      location: 'Egypt',
      height: '104',
      base: '220',
      volume: '1602895',
      constructionDate: 'c. 2590 BC',
    },
    {
      name: 'Bent Pyramid',
      location: 'Egypt',
      height: '101.1',
      base: '188.6',
      volume: '1200690',
      constructionDate: 'c. 2600 BC',
    },
    {
      name: 'Pyramid of the Sun',
      location: 'Mexico',
      height: '65',
      base: '225',
      volume: '1237097',
      constructionDate: 'c. 200 CE',
    },
  ]
</script>

@J-Sek J-Sek added T: bug Functionality that does not work as intended/expected C: VDataTable labels Mar 8, 2026
@J-Sek J-Sek merged commit 767b0e8 into vuetifyjs:master Mar 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: VDataTable T: bug Functionality that does not work as intended/expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report][3.11.6] Sortable headers can receive focus and update:sort-by events are emitted when disable-sort is truthy

2 participants