Skip to content

Commit

Permalink
feat(BTable): check selection also using primaryKey attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
makroxyz committed Feb 21, 2024
1 parent e031531 commit c540889
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/bootstrap-vue-next/src/components/BTable/BTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,16 @@ const selectedItemsSetUtilities = {
For some reason, the reference of the object gets lost. However, when you use an actual ref(), it works just fine
Getting the reference properly will fix all outstanding issues
*/
has: (item: Readonly<TableItem<T>>) => selectedItemsToSet.value.has(item),
has: (item: Readonly<TableItem<T>>) => {
if (!props.primaryKey) return selectedItemsToSet.value.has(item)
// Resolver for when we are using primary keys
const pkey = props.primaryKey as keyof TableItem<T>
for (const selected of selectedItemsToSet.value) {
if (selected[pkey] === item[pkey]) return true
}
return false
},
} as const
/**
Expand Down

0 comments on commit c540889

Please sign in to comment.