Skip to content

fix(hierarchical-grid): align selected data with expanded row indexes - 20.1.x#17301

Open
georgianastasov wants to merge 4 commits into
20.1.xfrom
ganastasov/fix-17295-20.1.x
Open

fix(hierarchical-grid): align selected data with expanded row indexes - 20.1.x#17301
georgianastasov wants to merge 4 commits into
20.1.xfrom
ganastasov/fix-17295-20.1.x

Conversation

@georgianastasov
Copy link
Copy Markdown
Contributor

Closes #17295

Description

This PR fixes a Hierarchical Grid issue where copying/selecting a cell from an expanded parent row returned the value from the previous row.

The fix uses dataView as the selected data source and keeps child-grid placeholder rows as null to preserve index alignment with visible rows.

Motivation / Context

After expanding the Artist Ahmad Nazeri row, copying its Artist cell returned Artist Babila Ebwélé instead of the selected row value.

This happened because selection indexes were based on visible rows, while the selected data source did not account for expanded child-grid placeholder rows.

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

Hierarchical Grid, cell selection/copy

How Has This Been Tested?

Added a regression test that expands the Artist Ahmad Nazeri row, selects its Artist cell, and verifies getSelectedData() returns the correct value instead of the previous row value.|

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version: 20.1.x
  • Browser(s): All
  • OS: All

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Hierarchical Grid cell selection/copy so that getSelectedData() returns the correct row data after expanding parent rows, by keeping selection row indexes aligned with the visible dataView (including child-grid placeholder rows).

Changes:

  • Override IgxHierarchicalGridComponent.getSelectedData() to use dataView and insert null placeholders for child-grid records to preserve visible row index alignment.
  • Restrict hierarchical expansion index compensation in extractDataFromSelection to only run when the selection source is filteredSortedData.
  • Add an integration regression test covering copy/selection from an expanded parent row.

Reviewed changes

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

File Description
projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.integration.spec.ts Adds a regression test verifying getSelectedData() returns correct data after expanding a parent row.
projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.ts Overrides getSelectedData() to use dataView and preserve index alignment with expanded child placeholders.
projects/igniteui-angular/src/lib/grids/grid-base.directive.ts Limits hierarchical expansion index adjustment to the filteredSortedData selection-source case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HierarchicalGrid copies value from previous row after row is expanded

2 participants