mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
fire selection event when re-entered (#14857)
This commit is contained in:
@@ -42,6 +42,13 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
|||||||
private _colorTheme: IColorTheme;
|
private _colorTheme: IColorTheme;
|
||||||
private _hasFocus: boolean;
|
private _hasFocus: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The flag is set to true when the table gains focus. When a row is selected and the flag is true the row selected event will
|
||||||
|
* fire regardless whether the row is already selected.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private _rowSelectionFocusFlag: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
||||||
@@ -309,8 +316,9 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
|||||||
if (!this.enableRowSelection) {
|
if (!this.enableRowSelection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.isRowSelected(row)) {
|
if (this._rowSelectionFocusFlag || !this.isRowSelected(row)) {
|
||||||
this._selectedRow = row;
|
this._selectedRow = row;
|
||||||
|
this._rowSelectionFocusFlag = false;
|
||||||
this._changeRef.detectChanges();
|
this._changeRef.detectChanges();
|
||||||
|
|
||||||
this.fireEvent({
|
this.fireEvent({
|
||||||
@@ -370,6 +378,7 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
|||||||
|
|
||||||
onFocusIn() {
|
onFocusIn() {
|
||||||
this._hasFocus = true;
|
this._hasFocus = true;
|
||||||
|
this._rowSelectionFocusFlag = true;
|
||||||
this._changeRef.detectChanges();
|
this._changeRef.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user