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): selection duplication #18908

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

websitevirtuoso
Copy link
Contributor

Description

Fix problem with duplicated selected records
#18877
Has to be checked by @KaelWD

Markup:

<template>
  <v-data-table
    v-model="selected"
    :headers="headers"
    :items="desserts"
    items-per-page="5"
    return-object
    show-select
  ></v-data-table>
<!--  select-strategy="all"-->

<!--  :value-comparator="comparator"-->
  <pre>{{ selected }}</pre>
</template>

<script setup lang="ts">
import { ref, toRaw } from 'vue'
const selected = ref([])
const headers = [
  {
    title: 'Dessert (100g serving)',
    align: 'start',
    key: 'name',
  },
  { title: 'Calories', align: 'end', key: 'calories' },
  { title: 'Fat (g)', align: 'end', key: 'fat' },
  { title: 'Carbs (g)', align: 'end', key: 'carbs' },
  { title: 'Protein (g)', align: 'end', key: 'protein' },
  { title: 'Iron (%)', align: 'end', key: 'iron' },
]
const desserts = [
  {
    id: 1,
    name: 'Frozen Yogurt',
    calories: 159,
    fat: 6.0,
    carbs: 24,
    protein: 4.0,
    iron: 1,
  },
  {
    id: 2,
    name: 'Ice cream sandwich',
    calories: 237,
    fat: 9.0,
    carbs: 37,
    protein: 4.3,
    iron: 1,
  },
  {
    id: 3,
    name: 'Eclair',
    calories: 262,
    fat: 16.0,
    carbs: 23,
    protein: 6.0,
    iron: 7,
  },
  {
    id: 4,
    name: 'Cupcake',
    calories: 305,
    fat: 3.7,
    carbs: 67,
    protein: 4.3,
    iron: 8,
  },
  {
    id: 5,
    name: 'Gingerbread',
    calories: 356,
    fat: 16.0,
    carbs: 49,
    protein: 3.9,
    iron: 16,
  },
  {
    id: 6,
    name: 'Jelly bean',
    calories: 375,
    fat: 0.0,
    carbs: 94,
    protein: 0.0,
    iron: 0,
  },
  {
    id: 7,
    name: 'Lollipop',
    calories: 392,
    fat: 0.2,
    carbs: 98,
    protein: 0,
    iron: 2,
  },
  {
    id: 8,
    name: 'Honeycomb',
    calories: 408,
    fat: 3.2,
    carbs: 87,
    protein: 6.5,
    iron: 45,
  },
  {
    id: 9,
    name: 'Donut',
    calories: 452,
    fat: 25.0,
    carbs: 51,
    protein: 4.9,
    iron: 22,
  },
  {
    id: 10,
    name: 'KitKat',
    calories: 518,
    fat: 26.0,
    carbs: 65,
    protein: 7,
    iron: 6,
  },
]
</script>

@websitevirtuoso websitevirtuoso changed the title Fix/v datatable selection fix(VDataTable) selection duplication Dec 20, 2023
@websitevirtuoso websitevirtuoso changed the base branch from master to dev December 20, 2023 06:35
@johnleider
Copy link
Member

I don't want to deter too much from the specifics of this P.R., but I feel like select.ts should probably be normalized as a framework composable and implemented in all areas that we do select behavior; or at least a conversation of what that might look like.

@johnleider johnleider changed the title fix(VDataTable) selection duplication fix(VDataTable): selection duplication Jan 17, 2024
@AntonioDell
Copy link

Is there something blocking this PR to get merged?

@johnleider
Copy link
Member

Is there something blocking this PR to get merged?

We're looking for developers to help with reviewing issues and pull requests, sorry for the delay.

@AntonioDell
Copy link

@johnleider The changes look quite focused and not very complex to review. As far as I can see it shouldn't break anything, but I am not sure if I'd be authorized to review here.

If I can help in any way, please tell me. Looking forward to this PR being merged :)

@johnleider
Copy link
Member

@johnleider The changes look quite focused and not very complex to review. As far as I can see it shouldn't break anything, but I am not sure if I'd be authorized to review here.

If I can help in any way, please tell me. Looking forward to this PR being merged :)

Data table is a complex component, we move a little slower with it. Hop on Discord if you want to chat about additional contributions :)

@johnleider johnleider added this to the v3.6.0 (Nebula) milestone Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

4 participants