Skip to content

Commit

Permalink
fix(Table): select all rows reactivity issue (#2200)
Browse files Browse the repository at this point in the history
  • Loading branch information
husamMousa authored Sep 16, 2024
1 parent bae7f3f commit 68124de
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/runtime/components/data/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,18 @@ export default defineComponent({
}
function selectAllRows () {
// Create a new array to ensure reactivity
const newSelected = [...selected.value]
// If the row is not already selected, add it to the newSelected array
props.rows.forEach((row) => {
// If the row is already selected, don't select it again
if (isSelected(row)) {
return
if (!isSelected(row)) {
newSelected.push(row)
}
// @ts-ignore
selected.value.push(row)
})
// Reassign the array to trigger Vue's reactivity
selected.value = newSelected
}
function onChange (checked: boolean) {
Expand Down

0 comments on commit 68124de

Please sign in to comment.