add select all handler to grid (#2496)

This commit is contained in:
Anthony Dresser
2018-09-10 21:18:39 -07:00
committed by Karl Burtram
parent b06ddf2dc7
commit 4ea13bdbc0
2 changed files with 5 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { range } from 'vs/base/common/arrays';
/**
* Implements the various additional navigation keybindings we want out of slickgrid
@@ -50,6 +51,8 @@ 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()));
} else {
handled = false;
}

View File

@@ -39,6 +39,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { CopyKeybind } from 'sql/base/browser/ui/table/plugins/copyKeybind.plugin';
import { AdditionalKeyBindings } from 'sql/base/browser/ui/table/plugins/additionalKeyBindings.plugin';
const ROW_HEIGHT = 29;
const HEADER_HEIGHT = 26;
@@ -317,6 +318,7 @@ class GridTable<T> extends Disposable implements IView {
this.table.registerPlugin(new AutoColumnSize());
this.table.registerPlugin(copyHandler);
this.table.registerPlugin(numberColumn);
this.table.registerPlugin(new AdditionalKeyBindings());
this._register(this.table.onContextMenu(this.contextMenu, this));
this._register(this.table.onClick(this.onTableClick, this));