fix cell selection bug
This commit is contained in:
parent
149fe6a79d
commit
c6a0ab7f13
@ -301,7 +301,10 @@ export default class CellManager {
|
|||||||
if (!cells) return false;
|
if (!cells) return false;
|
||||||
|
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
cells.map(index => this.getCell$(...index)).map($cell => $cell.classList.add('dt-cell--highlight'));
|
this._selectedCells = cells.map(index => this.getCell$(...index));
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
this._selectedCells.map($cell => $cell.classList.add('dt-cell--highlight'));
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,10 +322,10 @@ export default class CellManager {
|
|||||||
const cell1 = $.data($cell1);
|
const cell1 = $.data($cell1);
|
||||||
const cell2 = $.data($cell2);
|
const cell2 = $.data($cell2);
|
||||||
|
|
||||||
colIndex1 = cell1.colIndex;
|
colIndex1 = +cell1.colIndex;
|
||||||
rowIndex1 = cell1.rowIndex;
|
rowIndex1 = +cell1.rowIndex;
|
||||||
colIndex2 = cell2.colIndex;
|
colIndex2 = +cell2.colIndex;
|
||||||
rowIndex2 = cell2.rowIndex;
|
rowIndex2 = +cell2.rowIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rowIndex1 > rowIndex2) {
|
if (rowIndex1 > rowIndex2) {
|
||||||
@ -359,9 +362,10 @@ export default class CellManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
clearSelection() {
|
||||||
$.each('.dt-cell--highlight', this.bodyScrollable)
|
(this._selectedCells || [])
|
||||||
.map(cell => cell.classList.remove('dt-cell--highlight'));
|
.forEach($cell => $cell.classList.remove('dt-cell--highlight'));
|
||||||
|
|
||||||
|
this._selectedCells = [];
|
||||||
this.$selectionCursor = null;
|
this.$selectionCursor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user