Skip to content

Commit

Permalink
BTable delete selection when primary-key
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Curatitoli authored and VividLemon committed May 8, 2024
1 parent b74fb3b commit 55b4a00
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/bootstrap-vue-next/src/components/BTable/BTable.vue
Expand Up @@ -263,7 +263,19 @@ const selectedItemsSetUtilities = {
},
delete: (item: T) => {
const value = new Set(selectedItemsToSet.value)
value.delete(item)
if (props.primaryKey) {
const pkey: string = props.primaryKey
selectedItemsModel.value.forEach((v, i) => {
const selectedKey = get(v, pkey)
const itemKey = get(item, pkey)
if (!!selectedKey && !!itemKey && selectedKey === itemKey) {
value.delete(selectedItemsModel.value[i])
}
})
} else {
value.delete(item)
}
selectedItemsToSet.value = value
emit('row-unselected', item)
},
Expand Down

0 comments on commit 55b4a00

Please sign in to comment.