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

Allow for more customisability - New slot for the VDataTable #4691

Merged
merged 4 commits into from Aug 19, 2018
Merged

Allow for more customisability - New slot for the VDataTable #4691

merged 4 commits into from Aug 19, 2018

Conversation

DCzajkowski
Copy link
Contributor

@DCzajkowski DCzajkowski commented Jul 23, 2018

Description

Added a scoped slot for adding additional things to the data table's actions footer.

Motivation and Context

It allows for more customisability. Currently, to add anything to the actions footer one needs to remake whole table's footer.

How Has This Been Tested?

Visually

Before

After (gives possibility to append anything)

Markup:

<template>
  <v-data-table
    :headers="headers"
    :items="desserts"
    hide-actions
    class="elevation-1"
  >
    <template slot="items" slot-scope="props">
      <td>{{ props.item.name }}</td>
      <td class="text-xs-right">{{ props.item.calories }}</td>
      <td class="text-xs-right">{{ props.item.fat }}</td>
      <td class="text-xs-right">{{ props.item.carbs }}</td>
      <td class="text-xs-right">{{ props.item.protein }}</td>
      <td class="text-xs-right">{{ props.item.iron }}</td>
    </template>

    <!-- What was added -->

    <template slot="actions-extras">
      <v-btn color="green">New</v-btn>
    </template>
    
    <!-- /What was added -->

  </v-data-table>
</template>

<script>
  export default {
    data () {
      return {
        headers: [
          {
            text: 'Dessert (100g serving)',
            align: 'left',
            sortable: false,
            value: 'name'
          },
          { text: 'Calories', value: 'calories' },
          { text: 'Fat (g)', value: 'fat' },
          { text: 'Carbs (g)', value: 'carbs' },
          { text: 'Protein (g)', value: 'protein' },
          { text: 'Iron (%)', value: 'iron' }
        ],
        desserts: [
          {
            value: false,
            name: 'Frozen Yogurt',
            calories: 159,
            fat: 6.0,
            carbs: 24,
            protein: 4.0,
            iron: '1%'
          }
        ]
      }
    }
  }
</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 feature but make things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes, dev for new features and breaking changes).
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have created a PR in the documentation with the necessary changes.

@nekosaur
Copy link
Member

To make things consistent with the rest of the framework, I think it should probably be named actions-append. And you could add a actions-prepend slot as well.

@DCzajkowski
Copy link
Contributor Author

Good call. I'll update that today.

@DCzajkowski
Copy link
Contributor Author

Ok, done :)

@DCzajkowski
Copy link
Contributor Author

Is there any update on that? 😊

@johnleider johnleider merged commit 219e0d2 into vuetifyjs:dev Aug 19, 2018
@codecov
Copy link

codecov bot commented Aug 19, 2018

Codecov Report

Merging #4691 into dev will increase coverage by 1.31%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #4691      +/-   ##
==========================================
+ Coverage   88.89%   90.21%   +1.31%     
==========================================
  Files         227      208      -19     
  Lines        5376     4975     -401     
  Branches     1360     1277      -83     
==========================================
- Hits         4779     4488     -291     
+ Misses        479      389      -90     
+ Partials      118       98      -20
Impacted Files Coverage Δ
src/mixins/data-iterable.js 76.35% <ø> (ø) ⬆️
src/components/VMenu/mixins/menu-activator.js 44.44% <0%> (-3.71%) ⬇️
src/components/VDataTable/VEditDialog.js 20% <0%> (-2.59%) ⬇️
src/util/console.ts 69.64% <0%> (-1.79%) ⬇️
src/mixins/selectable.js 93.87% <0%> (-1.58%) ⬇️
src/directives/ripple.ts 41.37% <0%> (-0.67%) ⬇️
src/components/VOverflowBtn/VOverflowBtn.js 94.11% <0%> (-0.48%) ⬇️
src/components/VToolbar/VToolbar.js 95.08% <0%> (-0.38%) ⬇️
src/components/VMenu/VMenu.js 86.36% <0%> (-0.31%) ⬇️
... and 135 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 214e561...7e80bfd. Read the comment docs.

@DCzajkowski
Copy link
Contributor Author

Thanks 👍

@KaelWD KaelWD added this to the v1.2.0 milestone Aug 19, 2018
@ais-one
Copy link

ais-one commented Aug 28, 2018

I used it so far no issue...

@lock
Copy link

lock bot commented Apr 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants