Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VDataTable): group-by should use correct slot #10592

Merged
merged 2 commits into from
Feb 18, 2020

Conversation

nekosaur
Copy link
Member

Description

group-by functionality skipped potential item slot

Motivation and Context

closes #10289

How Has This Been Tested?

playground, unit test

Markup:

<template>
  <v-data-table
    :headers="headers"
    :items="desserts"
    item-key="name"
    group-by="category"
    class="elevation-1"
  >
    <template v-slot:group.header="{toggle,group,isOpen}">
      <td colspan="2" class="pl-0">
        <v-btn @click="toggle()" icon>
          <v-icon>mdi-{{isOpen?'arrow-up-drop-circle-outline':'arrow-down-drop-circle-outline'}}</v-icon>
        </v-btn>
        <span class="info--text">category:</span>
        {{group}}
      </td>
    </template>
    <template v-slot:item="{item}">
      <tr @click="Alert(item.name)">
        <td>
          {{item.name}}
        </td>
        <td>
          {{item.category}}
        </td>
      </tr>
    </template>
  </v-data-table>
</template>

<script>
  export default {
    data () {
      return {
        headers: [
          {
            text: 'Dessert (100g serving)',
            align: 'left',
            value: 'name',
          },
          { text: 'Category', value: 'category' },
        ],
        desserts: [
          {
            name: 'Frozen Yogurt',
            category: 'Ice cream',
          },
          {
            name: 'Ice cream sandwich',
            category: 'Ice cream',
          },
          {
            name: 'Eclair',
            category: 'Cookie',
          },
          {
            name: 'Cupcake',
            category: 'Pastry',
          },
          {
            name: 'Gingerbread',
            category: 'Cookie',
          },
          {
            name: 'Jelly bean',
            category: 'Candy',
          },
          {
            name: 'Lollipop',
            category: 'Candy',
          },
          {
            name: 'Honeycomb',
            category: 'Toffee',
          },
          {
            name: 'Donut',
            category: 'Pastry',
          },
          {
            name: 'KitKat',
            category: 'Candy',
          },
        ],
      }
    },
    methods: {
      Alert (x) {
        alert(x)
      },
    },
  }
</script>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any features but makes things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and backwards compatible changes and next for non-backwards compatible changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

@nekosaur nekosaur added the C: VDataTable VDatatable label Feb 16, 2020
@nekosaur nekosaur added this to the v2.2.x milestone Feb 16, 2020
@nekosaur nekosaur self-assigned this Feb 16, 2020
@MajesticPotatoe MajesticPotatoe added the T: bug Functionality that does not work as intended/expected label Feb 18, 2020
@MajesticPotatoe MajesticPotatoe merged commit 065e93c into master Feb 18, 2020
@MajesticPotatoe MajesticPotatoe deleted the fix/10289-data-table-group-by-slot branch February 18, 2020 13:38
Logikgate pushed a commit to flypapertech/vuetify that referenced this pull request Feb 19, 2020
closes vuetifyjs#10289

Co-authored-by: Andrew Henry <AMajesticPotatoe@gmail.com>
whoistobias pushed a commit to whoistobias/vuetify that referenced this pull request Feb 26, 2020
closes vuetifyjs#10289

Co-authored-by: Andrew Henry <AMajesticPotatoe@gmail.com>
@lock lock bot locked as resolved and limited conversation to collaborators Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: VDataTable 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] data-table group-by not using item slot
3 participants