fix: multiple row select on sorted tables not work properly

This commit is contained in:
Fabio Di Stasio 2021-05-11 18:32:11 +02:00
parent 496490b14a
commit c7663be338
1 changed files with 6 additions and 4 deletions

View File

@ -408,15 +408,15 @@ export default {
this.selectedRows.push(row);
else {
const lastID = this.selectedRows.slice(-1)[0];
const lastIndex = this.localResults.findIndex(el => el._id === lastID);
const clickedIndex = this.localResults.findIndex(el => el._id === row);
const lastIndex = this.sortedResults.findIndex(el => el._id === lastID);
const clickedIndex = this.sortedResults.findIndex(el => el._id === row);
if (lastIndex > clickedIndex) {
for (let i = clickedIndex; i < lastIndex; i++)
this.selectedRows.push(this.localResults[i]._id);
this.selectedRows.push(this.sortedResults[i]._id);
}
else if (lastIndex < clickedIndex) {
for (let i = clickedIndex; i > lastIndex; i--)
this.selectedRows.push(this.localResults[i]._id);
this.selectedRows.push(this.sortedResults[i]._id);
}
}
}
@ -435,6 +435,8 @@ export default {
sort (field) {
if (!this.isSortable) return;
this.selectedRows = [];
if (this.mode === 'query')
field = `${this.getTable(this.resultsetIndex)}.${field}`;