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(VTreeview): independent selection inheriting parent state #14956

Merged
merged 2 commits into from Apr 21, 2022

Conversation

ThomasKientz
Copy link
Contributor

Description

fixes #14955

Motivation and Context

How Has This Been Tested?

visually

Markup:

<template>
  <v-app id="inspire">
    <v-main>
      <v-btn
        color="info"
        @click="setSelected"
      >select last added</v-btn>
      <!-- selection-type="independent" -->
      <v-treeview
        v-model="selectedItems"
        dense
        selectable
        :items="items"
        :load-children="loadChildren"
      ></v-treeview> </v-main></v-app>
</template>

<script>
  export default {
    data: () => ({
      selectedItems: [],
      ctr: 0,
      items: [
        {
          id: 1,
          name: '1',
          children: [
            { id: 2, name: '2', children: [] },
            { id: 3, name: '3', children: [] },
            { id: 4, name: '4', children: [] },
          ],
        },
      ],
    }),
    methods: {
      setSelected () {
        this.selectedItems.push('new_' + (this.ctr - 1))
      },
      loadChildren (node) {
        const id = 'new_' + this.ctr++
        node.children.push({ id, name: id, children: [] })
      },
    },
  }
</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)

@KaelWD KaelWD changed the title fix(VTreeview): selection-type independent + load children fix(VTreeview): independent selection inheriting parent state Apr 21, 2022
@KaelWD KaelWD merged commit 2034df6 into vuetifyjs:master Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][2.6.4] VTreeview with selection-type="independent". Async children are keeping parent's state.
2 participants