Selection in grid context (#2527)

* update action context on selection change

* correctly add ranges rather than a new range for every row

* add required functions to typings
This commit is contained in:
Anthony Dresser
2018-09-11 17:10:53 -07:00
committed by Karl Burtram
parent c559ac7be9
commit 89e6d363e2
6 changed files with 47 additions and 24 deletions

View File

@@ -52,7 +52,13 @@ export class AdditionalKeyBindings<T> implements Slick.Plugin<T> {
} else if (event.equals(KeyCode.End | KeyMod.CtrlCmd)) {
this.grid.setActiveCell(this.grid.getDataLength() - 1, this.grid.getColumns().length - 1);
} else if (event.equals(KeyCode.KEY_A | KeyMod.CtrlCmd)) {
this.grid.setSelectedRows(range(this.grid.getDataLength()));
// check if we can set the rows directly on the selectionModel, its cleaner
let selectionModel = this.grid.getSelectionModel();
if (selectionModel) {
selectionModel.setSelectedRanges([new Slick.Range(0, 0, this.grid.getDataLength() - 1, this.grid.getColumns().length - 1)]);
} else {
this.grid.setSelectedRows(range(this.grid.getDataLength()));
}
} else {
handled = false;
}