Skip to content

Commit

Permalink
fix: multiple row select on sorted tables not work properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed May 11, 2021
1 parent 496490b commit c7663be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/renderer/components/WorkspaceQueryTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand All @@ -435,6 +435,8 @@ export default {
sort (field) {
if (!this.isSortable) return;
this.selectedRows = [];
if (this.mode === 'query')
field = `${this.getTable(this.resultsetIndex)}.${field}`;
Expand Down

0 comments on commit c7663be

Please sign in to comment.