Skip to content

Commit

Permalink
TableOutputComponent: Reset navigating selection if new search
Browse files Browse the repository at this point in the history
Reset the selection once upon navigating, when a new search just
happened. Before this change, navigating to the next filtered entry
in the table, after a new yet differing search, didn't select the first
newly highlighted entry. Now, upon the user updating a search filter,
the proper (first) filtered entry gets selected next.

This doesn't address the issue with Enter being hit quickly while
editing Search field(s). That remains to be fixed as follow-up. This
however fixes the case of hitting Enter less quickly while in Search.

Contributes to fixing #859.

Signed-off-by: Marco Miller <marco.miller@ericsson.com>
  • Loading branch information
marco-miller committed Nov 1, 2022
1 parent 97457e1 commit 21fa207
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
private frameworkComponents: any;
private gridApi: GridApi | undefined = undefined;
private gridRedrawn = false;
private gridSearched = false;
private columnApi: ColumnApi | undefined = undefined;
private prevStartTimestamp = -BigInt(2 ** 63);
private startTimestamp = BigInt(2 ** 63);
Expand Down Expand Up @@ -609,6 +610,7 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
});
this.gridApi.redrawRows();
}
this.gridSearched = true;
this.gridRedrawn = false;
}

Expand Down Expand Up @@ -638,6 +640,11 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
// wait for grid to be done being redrawn -elsewhere (before assuming it)
await new Promise(cb => setTimeout(cb, msBetweenChecks));
}
if (this.gridSearched) {
// reset the selection once, upon new search filter just applied
this.selectStartIndex = this.selectEndIndex = -1;
this.gridSearched = false;
}

// 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 21fa207

Please sign in to comment.