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): set initial values for sort-desc and group-desc #11342

Merged
merged 1 commit into from May 24, 2020

Conversation

nekosaur
Copy link
Member

@nekosaur nekosaur commented May 7, 2020

Description

supplying sort-by and/or group-by values without corresponding sort-desc/group-by values could lead to issues when sorting/grouping

Motivation and Context

closes #9685

How Has This Been Tested?

playground, updated existing test

Markup:

<template>
  <v-container>
    <v-data-table
      :headers="headers"
      :items="desserts"
      item-key="name"
      group-by="category"
      :sort-by="sortBy"
      show-group-by
      multi-sort
    ></v-data-table>
  </v-container>
</template>

<script>
  export default {
    data () {
      return {
        sortBy: ['category', 'name'],
        headers: [
          { text: "Category", value: "category" },
          { text: "Dessert (100g serving)", align: "left", 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: [
          {
            name: "Frozen Yogurt",
            calories: 159,
            fat: 6.0,
            carbs: 24,
            protein: 4.0,
            iron: "1%",
            category: "Ice cream"
          },
          {
            name: "Ice cream sandwich",
            calories: 237,
            fat: 9.0,
            carbs: 37,
            protein: 4.3,
            iron: "1%",
            category: "Ice cream"
          },
          {
            name: "Eclair",
            calories: 262,
            fat: 16.0,
            carbs: 23,
            protein: 6.0,
            iron: "7%",
            category: "Cookie"
          },
          {
            name: "Cupcake",
            calories: 305,
            fat: 3.7,
            carbs: 67,
            protein: 4.3,
            iron: "8%",
            category: "Pastry"
          },
          {
            name: "Gingerbread",
            calories: 356,
            fat: 16.0,
            carbs: 49,
            protein: 3.9,
            iron: "16%",
            category: "Cookie"
          },
          {
            name: "Jelly bean",
            calories: 375,
            fat: 0.0,
            carbs: 94,
            protein: 0.0,
            iron: "0%",
            category: "Candy"
          },
          {
            name: "Lollipop",
            calories: 392,
            fat: 0.2,
            carbs: 98,
            protein: 0,
            iron: "2%",
            category: "Candy"
          },
          {
            name: "Honeycomb",
            calories: 408,
            fat: 3.2,
            carbs: 87,
            protein: 6.5,
            iron: "45%",
            category: "Toffee"
          },
          {
            name: "Donut",
            calories: 452,
            fat: 25.0,
            carbs: 51,
            protein: 4.9,
            iron: "22%",
            category: "Pastry"
          },
          {
            name: "KitKat",
            calories: 518,
            fat: 26.0,
            carbs: 65,
            protein: 7,
            iron: "6%",
            category: "Candy"
          }
        ]
      };
    }
  }
</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 May 7, 2020
@nekosaur nekosaur added this to the v2.2.x milestone May 7, 2020
@nekosaur nekosaur self-assigned this May 7, 2020
@johnleider johnleider added the T: bug Functionality that does not work as intended/expected label May 12, 2020
supplying sort-by and/or group-by values without corresponding
sort-desc/group-by values could lead to issues when sorting/grouping

closes #9685
@johnleider johnleider force-pushed the fix/9685-data-table-initial-desc-values branch from 0936bac to b5335d7 Compare May 12, 2020 17:36
@johnleider johnleider merged commit 8a78533 into master May 24, 2020
@johnleider johnleider deleted the fix/9685-data-table-initial-desc-values branch May 24, 2020 13:10
johnleider pushed a commit that referenced this pull request May 29, 2020
)

fixes #9685

supplying sort-by and/or group-by values without corresponding
sort-desc/group-by values could lead to issues when sorting/grouping
johnleider pushed a commit that referenced this pull request Jun 2, 2020
)

fixes #9685

supplying sort-by and/or group-by values without corresponding
sort-desc/group-by values could lead to issues when sorting/grouping
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 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 Initial Group-By breaks sorting if Group-Desc not specified
2 participants