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): no multiple select if last entry not selected #13686

Merged

Conversation

florealcab
Copy link
Contributor

Description

If the last selected item is no more selected, we should not reselect it and all items between if we press "shift" and click on another item. Instead, ignore the shift behavior in this case.

fixes #13684

Motivation and Context

#13684

How Has This Been Tested?

There was no test for this feature (or I missed them), so I don't add unit tests. I test with my real example and it fixes the problem.

Markup:

// Paste your FULL Playground.vue here
<template>
  <v-app>
    <v-container>
      <v-data-table
              :headers="table_headers"
              :items="table_data"
              item-key="name"
              show-select
      ></v-data-table>
    </v-container>
  </v-app>
</template>
<script>
  module.exports = {
        data: function() {
            return {
                table_data: [
                    {
                        "name": 1,
                        "column1": "Toto",
                        "column2": "Tutu"
                    },
                    {
                        "name": 2,
                        "column1": "Toto",
                        "column2": "Tutu"
                    },
                    {
                        "name": 3,
                        "column1": "Toto",
                        "column2": "Tutu"
                    },
                    {
                        "name": 4,
                        "column1": "Toto",
                        "column2": "Tutu"
                    }
                ],
                table_headers: [
                        {align: "left", text: "Column 1", value: "column1"},
                        {align: "left", text: "Column 2", value: "column2"}
                ]
            }
        }
    }
</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)

@ElijahKotyluk ElijahKotyluk added the T: bug Functionality that does not work as intended/expected label May 22, 2021
@KaelWD KaelWD added the C: VDataIterator VDataiterator label May 31, 2021
@KaelWD KaelWD added this to the v2.5.x milestone May 31, 2021
@KaelWD
Copy link
Member

KaelWD commented May 31, 2021

This seems to remove shift key deselection entirely.

  • Select all items
  • Deselect the second one
  • Hold shift and deselect the fourth

I'd expect 2,3,4 to be deselected, but now only 2 and 4 are.

@florealcab
Copy link
Contributor Author

Oh yes, I fix that. Now if last entry is selected, shift cause select of items between, else shift cause unselect of them.

@KaelWD KaelWD changed the title fix(VDataIterator): no multipleSelect if lastEntry not selected fix(VDataTable): no multiple select if last entry not selected Jul 19, 2021
@KaelWD KaelWD merged commit 9fd2afa into vuetifyjs:master Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDataIterator VDataiterator T: bug Functionality that does not work as intended/expected
Projects
None yet
4 participants