Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gabrielpetersson/a225eb988ea2a6096a3f90752c88a542 to your computer and use it in GitHub Desktop.
Save gabrielpetersson/a225eb988ea2a6096a3f90752c88a542 to your computer and use it in GitHub Desktop.
if (isSearchBarClosing) {
(async () => {
await wait(300);
if (gridApi == null) {
return;
}
const ranges = gridApi.getCellRanges();
if (ranges?.length !== 1) {
return;
}
const range = ranges[0]!;
const startRowIndex = range.startRow?.rowIndex;
const endRowIndex = range.endRow?.rowIndex;
const isOnlyOneCellInRange =
startRowIndex != null &&
(range.columns.length !== 1 || startRowIndex === endRowIndex);
if (!isOnlyOneCellInRange) {
return;
}
focusGridCell(startRowIndex, range.columns[0]!, gridApi);
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment