Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions src/components/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -772,16 +772,6 @@ export default {
this.clearSelected()
}
},
perPage (newVal, oldVal) {
if (oldVal !== newVal) {
this.clearSelected()
}
},
currentPage (newVal, oldVal) {
if (oldVal !== newVal) {
this.clearSelected()
}
},
// Update .sync props
localSortDesc (newVal, oldVal) {
// Emit update to sort-desc.sync
Expand All @@ -802,10 +792,26 @@ export default {
}
},
// Watch for changes on computedItems and update the v-model
computedItems (newVal, OldVal) {
computedItems (newVal, oldVal) {
// Reset for selectable
this.lastRowClicked = -1
this.$emit('input', newVal)
let equal = false
if (this.selectable && this.selectedRows.length > 0) {
// Quick check against array length
equal = isArray(newVal) && isArray(oldVal) && newVal.length === oldVal.length
for (let i = 0; equal && i < newVal.length; i++) {
// Look for the first non-loosely equal row, after ignoring reserved fields
equal = looseEqual(sanitizeRow(newVal[i]), sanitizeRow(oldVal[i]))
}
}
if (!equal) {
this.clearSelected()
}
},
selectable (newVal, oldVal) {
// Clear selection if prop selectable changes
this.clearSelected()
},
// Watch for changes to the filter criteria and filtered items vs localItems).
// And set visual state and emit events as required
Expand Down Expand Up @@ -1272,6 +1278,7 @@ export default {
let selected = !this.selectedRows[index]
switch (this.selectMode) {
case 'single':
case 'radio':
this.selectedRows = []
break
case 'range':
Expand Down Expand Up @@ -1385,6 +1392,7 @@ export default {
// Can't force an update when busy
return false
}
this.clearSelected()
if (this.hasProvider) {
this.$nextTick(this._providerUpdate)
} else {
Expand Down