Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
[terra-worklist-data-grid] Fixes column index out of range for displa…
Browse files Browse the repository at this point in the history
…yed columns (#2071)

Co-authored-by: Sugan G <[email protected]>
  • Loading branch information
sugan2416 and Sugan G authored Mar 8, 2024
1 parent a8ab03a commit 18ea76a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions packages/terra-data-grid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* Added
* Added support for orange and green column highlighting.

* Fixed
* Fixes column index out of bounds in row selection mode.

## 1.18.0 - (March 5, 2024)

* Changed
Expand Down
10 changes: 6 additions & 4 deletions packages/terra-data-grid/src/DataGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,12 @@ const DataGrid = forwardRef((props, ref) => {
setFocusedRow(newRowIndex);
setFocusedCol(newColIndex);

focusedCellRef.current = {
rowId: grid.current.rows[newRowIndex].getAttribute('data-row-id'),
columnId: displayedColumns[newColIndex].id,
};
if (newColIndex < displayedColumns.length) {
focusedCellRef.current = {
rowId: grid.current.rows[newRowIndex].getAttribute('data-row-id'),
columnId: displayedColumns[newColIndex].id,
};
}

if (makeActiveElement) {
let focusedCell;
Expand Down

0 comments on commit 18ea76a

Please sign in to comment.