fix the grid goes blank issue (#20209)

This commit is contained in:
Alan Ren
2022-07-29 18:12:02 -07:00
committed by GitHub
parent afe1b4392f
commit 67ecd6d3d9
3 changed files with 2 additions and 16 deletions

View File

@@ -127,7 +127,7 @@ export class CellSelectionModel<T> implements Slick.SelectionModel<T, Array<Slic
} else {
ranges = [new Slick.Range(0, columnIndex, this.grid.getDataLength() - 1, columnIndex)];
}
this.grid.setActiveCell(0, columnIndex);
this.grid.setActiveCell(this.grid.getViewport()?.top ?? 0, columnIndex);
this.setSelectedRanges(ranges);
}
}

View File

@@ -39,7 +39,7 @@ export class RowNumberColumn<T> implements Slick.Plugin<T> {
private handleHeaderClick(e: MouseEvent, args: Slick.OnHeaderClickEventArgs<T>): void {
if (args.column.id === 'rowNumber') {
this.grid.setActiveCell(0, 1);
this.grid.setActiveCell(this.grid.getViewport()?.top ?? 0, 1);
let selectionModel = this.grid.getSelectionModel();
if (selectionModel) {
selectionModel.setSelectedRanges([new Slick.Range(0, 0, this.grid.getDataLength() - 1, this.grid.getColumns().length - 1)]);