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

feat(VDataTable): add isOpen to group.header slot #9721

Merged
merged 1 commit into from Dec 17, 2019

Conversation

Daanra
Copy link
Contributor

@Daanra Daanra commented Nov 18, 2019

Description

Adds 'isOpen' as a prop to the group.header slot.

Motivation and Context

Currently, the toggle function is passed as a prop to the group.header slot. However, when utilizing this method, you probably want to display a different icon depending on whether the header is opened or not (as is happening in the default implementation).

How Has This Been Tested?

Visually (playground)

Markup:

<template>
  <v-container>
    <v-data-table :items="items" :headers="headers" group-by="type">
      <template #group.header="{ isOpen, toggle }">
        <v-btn @click="toggle" icon>
          <v-icon>
            {{ isOpen ? '$minus' : '$plus' }}
          </v-icon>
        </v-btn>
      </template>
    </v-data-table>
  </v-container>
</template>

<script>
export default {
  data: () => ({
    items: [{
      type: 1,
      name: 'First',
    }, {
      type: 2,
      name: 'Second',
    }, {
      type: 1,
      name: 'Third'
    }],
    headers: [{
      text: 'Type',
      value: 'type'
    }, {
      text: 'Name',
      value: 'name',
    }]
  })
}
</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 breaking 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)
  • I've added new examples to the kitchen (applies to new features and breaking changes in core library)

Adds 'isOpen' as a prop to the group.header slot.
@Daanra Daanra changed the title feat(vdatatable): add isOpen to group.header slot feat(VDataTable): add isOpen to group.header slot Nov 18, 2019
@nekosaur
Copy link
Member

nekosaur commented Nov 18, 2019

update the api-generator map file as well

@johnleider johnleider added C: VDataTable VDatatable T: feature A new feature labels Nov 30, 2019
@johnleider
Copy link
Member

Do we have a baseline naming convention for active state? I don't think we use isOpen anywhere.

@jacekkarczmarczyk jacekkarczmarczyk added this to the v2.2.0 milestone Dec 6, 2019
@johnleider johnleider merged commit bb26a2e into vuetifyjs:dev Dec 17, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: VDataTable VDatatable T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants