Skip to content

[Bug Report][3.9.7] Selection is not functioning correctly in the group-header slot of the Data Table component. #22014

Closed as duplicate

Description

@rustem-nasyrov

Environment

Vuetify Version: 3.9.7
Vue Version: 3.5.21
OS: macOS 10.15 (current)

Steps to reproduce

  1. Use the v-data-table component.
  2. Add a custom component or markup to the #group-header slot.
  3. Add a checkbox component or an HTML input element, along with a group label.
  4. Use slot scope props to implement the selection logic.

Expected Behavior

  1. The "Select all" checkbox in the header should select all groups, subgroups and items.
  2. Selecting top group should select all subgroups and items or selecting subgroup should select its all subgroups and items.

Actual Behavior

The component can select either individual groups and items or only root groups and items.

Reproduction Link

https://play.vuetifyjs.com/#...

Images

https://cdn.cosmicjs.com/70747920-8a55-11f0-b401-3914bc05435b-Screenshot-2025-09-05-at-4-39-46PM.png

Reproduction source code

Code to reproduce
<template>
  <v-data-table
    v-model="selected"
    :group-by="groupBy"
    :items="items"
    item-value="name"
    show-select
  >
    <template #group-header="{item, isSelected, toggleGroup, toggleSelect}">
      <tr>
        <td colspan="10">
          <div
            class="d-flex align-center"
            :style="{paddingLeft: `${item.depth * 16}px`} "
          >
            <v-checkbox-btn
              :model-value="isSelected(item)"
              @click="toggleSelect(!isSelected(item))"
              style="flex: 0 auto"
            />
            <span>{{item.value}}</span>
            &nbsp;
            <v-btn
              density="compact"
              variant="flat"
              @click="toggleGroup(item)"
              color="primary"
              >toggle</v-btn
            >
          </div>
        </td>
      </tr>
    </template>
  </v-data-table>
</template>

<script>
  export default {
    data () {
      return {
        selected: [],
        groupBy: [
          { key: 'name', order: 'asc' },
          { key: 'location', order: 'asc' },
        ],
        items: [
          {
            name: '🍎 Apple',
            location: 'Washington',
            height: '0.1',
            base: '0.07',
            volume: '0.0001',
          },
          {
            name: '🍌 Banana',
            location: 'Ecuador',
            height: '0.2',
            base: '0.05',
            volume: '0.0002',
          },
          {
            name: '🍇 Grapes',
            location: 'Italy',
            height: '0.02',
            base: '0.02',
            volume: '0.00001',
          },
          {
            name: '🍉 Watermelon',
            location: 'China',
            height: '0.4',
            base: '0.3',
            volume: '0.03',
          },
          {
            name: '🍍 Pineapple',
            location: 'Thailand',
            height: '0.3',
            base: '0.2',
            volume: '0.005',
          },
          {
            name: '🍒 Cherries',
            location: 'Turkey',
            height: '0.02',
            base: '0.02',
            volume: '0.00001',
          },
          {
            name: '🥭 Mango',
            location: 'India',
            height: '0.15',
            base: '0.1',
            volume: '0.0005',
          },
          {
            name: '🍓 Strawberry',
            location: 'USA',
            height: '0.03',
            base: '0.03',
            volume: '0.00002',
          },
          {
            name: '🍑 Peach',
            location: 'China',
            height: '0.09',
            base: '0.08',
            volume: '0.0004',
          },
          {
            name: '🥝 Kiwi',
            location: 'New Zealand',
            height: '0.05',
            base: '0.05',
            volume: '0.0001',
          },
        ],
      }
    },
  }
</script>

Activity

  1. jcjp commented on Sep 6, 2025

    @jcjp
    Contributor

    In my opinion treeview component is a better alternative to your use case, look here: https://vuetifyjs.com/en/components/treeview/#selectable-icons.

  2. rustem-nasyrov commented on Oct 13, 2025

    @rustem-nasyrov
    Author

    @jcjp, nope. I needed a data table. If I wanted to use the tree view component, I’d be using that instead. :)

  3. J-Sek commented on Oct 14, 2025

    @J-Sek
    Contributor

    I don't think it is supported at all. Hope you are up for a tough fight against the framework.

  4. added and removed
    T: bugFunctionality that does not work as intended/expected
    on Oct 14, 2025
  5. rustem-nasyrov commented on Oct 15, 2025

    @rustem-nasyrov
    Author

    Hope you are up for a tough fight against the framework.

    I do. :')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions