select the row on double click (#22456)

* select row on double click

* skip row number column
This commit is contained in:
Alan Ren
2023-03-24 20:10:05 -07:00
committed by GitHub
parent 35cb233851
commit 86e6b42bdc

View File

@@ -549,6 +549,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
this._register(this.dataProvider.onFilterStateChange(() => { this.layout(); }));
this._register(this.table.onContextMenu(this.contextMenu, this));
this._register(this.table.onClick(this.onTableClick, this));
this._register(this.table.onDoubleClick(this.onTableDoubleClick, this));
this._register(this.dataProvider.onFilterStateChange(() => {
const columns = this.table.columns as FilterableColumn<T>[];
this.state.columnFilters = columns.filter((column) => column.filterValues?.length > 0).map(column => {
@@ -767,6 +768,15 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
}
}
private onTableDoubleClick(event: ITableMouseEvent) {
// the first column is already handled by rowNumberColumn plugin.
if (event.cell && event.cell.cell !== 0) {
// upon double clicking, we want to select the entire row so that it is easier to know which
// row is selected when the user needs to scroll horizontally.
this.table.grid.setSelectedRows([event.cell.row]);
}
}
public updateResult(resultSet: ResultSetSummary) {
this._resultSet = resultSet;
if (this.table && this.visible) {