Skip to content

Commit

Permalink
TableOutputComponent: Wait for search before selecting
Browse files Browse the repository at this point in the history
Wait for the grid to be done being redrawn, if still ongoing upon a
search, before applying user's potential selection change.

Contributes to fixing #859.

Signed-off-by: Marco Miller <marco.miller@ericsson.com>
  • Loading branch information
marco-miller committed Nov 1, 2022
1 parent 1c2f1d0 commit 32dc39f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
private showIndexColumn = false;
private frameworkComponents: any;
private gridApi: GridApi | undefined = undefined;
private gridRedrawn = false;
private columnApi: ColumnApi | undefined = undefined;
private prevStartTimestamp = -BigInt(2 ** 63);
private startTimestamp = BigInt(2 ** 63);
Expand Down Expand Up @@ -586,6 +587,7 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
};

private searchEvents(colName: string, filterValue: string) {
this.gridRedrawn = true;
if (filterValue === '') {
this.filterModel.delete(colName);
} else {
Expand All @@ -603,6 +605,7 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
});
this.gridApi.redrawRows();
}
this.gridRedrawn = false;
}

private async findMatchIndex(currRowIndex: number, direction = Direction.NEXT) {
Expand All @@ -626,6 +629,11 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
private async findMatchedEvent(direction: Direction) {
let isFound = false;
if (this.gridApi) {
const msBetweenChecks = 100;
while (this.gridRedrawn) {
// wait for grid to be done being redrawn -elsewhere (before assuming it)
await new Promise(cb => setTimeout(cb, msBetweenChecks));
}

// make sure that both index are either both -1 or both have a valid number
if (this.selectStartIndex !== -1 && this.selectEndIndex === -1) {
Expand Down

0 comments on commit 32dc39f

Please sign in to comment.