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 cellClass property to headers #11775

Merged
merged 4 commits into from
Oct 6, 2020

Conversation

peteruithoven
Copy link
Contributor

@peteruithoven peteruithoven commented Jul 1, 2020

Description

DataTable headers cellClass property enabling adding classes to td's

fix #8474

Motivation and Context

It's hard to add classes to DataTable cells / td's. Being able to add these classes more easilly enables:

  • Tweaking width of columns when the header is hidden (hide-default-header)
  • Changing the padding in the cells
  • Other kinds of styling that would otherwise require a extra element like setting a background or text color.

Also see: #8474

How Has This Been Tested?

I've tested this in the Playground and I've added a unit test:
https://github.com/vuetifyjs/vuetify/pull/11775/files#diff-44a9b747492d2b82ba824229ad9e5800

Markup:

<template>
  <v-container>
    <v-data-table
      :headers="headers"
      :items="items"
    />
  </v-container>
</template>

<script>
  export default {
    data () {
      return {
        headers: [
          { text: 'Impact', value: 'name', cellClass: 'pl-0' },
          { text: 'Score', value: 'score', align: 'end', cellClass: ['pt-8', 'pb-8'] },
          { text: 'Counter', value: 'counter', align: 'end' },
        ],
        items: [
          { name: 'A', score: 10, counter: 1 },
          { name: 'B', score: 20, counter: 2 },
          { name: 'C', score: 30, counter: 3 },
        ],
      }
    },
  }
</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)

I'm not sure what to add to the documentation? I did update the API.

@ibrahimBeladi
Copy link
Contributor

@nekosaur
Could you review this pull request?

@nekosaur

This comment has been minimized.

@KaelWD KaelWD added this to the v2.4.0 milestone Oct 6, 2020
@KaelWD KaelWD added C: VDataTable VDatatable T: feature A new feature labels Oct 6, 2020
@KaelWD KaelWD requested a review from nekosaur October 6, 2020 08:18
@KaelWD KaelWD changed the title feat(datatable row): DataTable header cellClass feat(VDataTable): add cellClass property to headers Oct 6, 2020
@KaelWD KaelWD merged commit 8d06d45 into vuetifyjs:dev Oct 6, 2020
jyburns pushed a commit to jyburns/vuetify that referenced this pull request Oct 11, 2020
@milakucher
Copy link

it's been a while, but thanks for the cellClass anyway! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDataTable VDatatable T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants