Fix Row marking (#2458)

Fix row marking issue discovered during r4.2 testing
This commit is contained in:
Deep Tailor 2019-08-30 15:46:36 -07:00 committed by Andrew Henry
parent a0864a8702
commit 4f3a3befe0

View File

@ -733,9 +733,21 @@ export default {
this.markedRows.forEach(r => r.marked = false);
this.markedRows = [];
},
unmarkRow(rowIndex) {
this.undoMarkedRows();
this.unpause();
unmarkRow(rowIndex, ctrlKeyModifier) {
if (ctrlKeyModifier) {
let row = this.visibleRows[rowIndex],
positionInMarkedArray = this.markedRows.indexOf(row);
row.marked = false;
this.markedRows.splice(positionInMarkedArray, 1);
if (this.markedRows.length === 0) {
this.unpause();
}
} else if (this.markedRows.length) {
this.undoMarkedRows();
this.markRow(rowIndex);
}
},
markRow(rowIndex, keyModifier) {
if (!this.enableMarking) {
@ -785,16 +797,18 @@ export default {
//supports backward selection
if (lastRowIndex < firstRowIndex) {
let temp = lastRowIndex;
lastRowIndex = firstRowIndex;
firstRowIndex = temp - 1;
[firstRowIndex, lastRowIndex] = [lastRowIndex, firstRowIndex];
}
for (var i = firstRowIndex + 1; i <= lastRowIndex; i++) {
let baseRow = this.markedRows[0];
for (var i = firstRowIndex; i <= lastRowIndex; i++) {
let row = allRows[i];
row.marked = true;
this.markedRows.push(row);
if (row !== baseRow){
this.markedRows.push(row);
}
}
}
}