Skip to content

fix(body): preserve original cell index - #804

Open
spike-rabbit wants to merge 1 commit into
mainfrom
fix/body-row-cell-index
Open

fix(body): preserve original cell index#804
spike-rabbit wants to merge 1 commit into
mainfrom
fix/body-row-cell-index

Conversation

@spike-rabbit

Copy link
Copy Markdown
Member

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

Cell activation reports a cellIndex relative to its pinned render group, so the index resets for left, center, and right groups.

What is the new behavior?

Cell activation now reports the index from the original columns array. A keyboard-navigation regression test covers a pinned column.

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

Tests: npx ng test ngx-datatable-lib --watch=false --include='projects/ngx-datatable/src/lib/components/body/keyboard-navigation.spec.ts'

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to fix ActivateEvent.cellIndex for cell activation so it reflects the index in the original columns input array (instead of resetting within each pinned render group). This is relevant to consumers who use cellIndex to map back to their column definitions when columns are pinned.

Changes:

  • Update body row cell-activation handling to compute cellIndex from the full columns() list rather than the per-pin-group loop index.
  • Extend keyboard navigation tests to capture activate events and assert cellIndex behavior for a pinned column.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
projects/ngx-datatable/src/lib/components/body/body-row.component.ts Changes how cellIndex is computed during cell activation by passing the column instead of $index.
projects/ngx-datatable/src/lib/components/body/keyboard-navigation.spec.ts Adds an activate listener and a regression test asserting cellIndex for a pinned column.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@spike-rabbit
spike-rabbit marked this pull request as draft August 17, 2026 09:34
@fh1ch fh1ch added the bug Something isn't working label Aug 18, 2026
@spike-rabbit
spike-rabbit force-pushed the fix/body-row-cell-index branch from 3a911af to 7a6f69e Compare August 20, 2026 06:48
Columns may internally be reordered due to frozen left/right.
This change now makes sure that keyboard navigation always
maintains a proper index when navigating and selecting cells.
@spike-rabbit
spike-rabbit force-pushed the fix/body-row-cell-index branch from 7a6f69e to 27a9b6d Compare August 20, 2026 06:51
@spike-rabbit
spike-rabbit marked this pull request as ready for review August 20, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants