fix(hierarchical-grid): align selected data with expanded row indexes - 20.1.x#17301
Open
georgianastasov wants to merge 4 commits into
Open
fix(hierarchical-grid): align selected data with expanded row indexes - 20.1.x#17301georgianastasov wants to merge 4 commits into
georgianastasov wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
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 usedataViewand insertnullplaceholders for child-grid records to preserve visible row index alignment. - Restrict hierarchical expansion index compensation in
extractDataFromSelectionto only run when the selection source isfilteredSortedData. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
dataViewas the selected data source and keeps child-grid placeholder rows asnullto preserve index alignment with visible rows.Motivation / Context
After expanding the
Artist Ahmad Nazerirow, copying itsArtistcell returnedArtist 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):
Component(s) / Area(s) Affected:
Hierarchical Grid, cell selection/copy
How Has This Been Tested?
Added a regression test that expands the
Artist Ahmad Nazerirow, selects itsArtistcell, and verifiesgetSelectedData()returns the correct value instead of the previous row value.|Test Configuration:
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)