fix(hierarchical-grid): align selected data with expanded row indexes - master#17299
Open
georgianastasov wants to merge 4 commits into
Open
fix(hierarchical-grid): align selected data with expanded row indexes - master#17299georgianastasov 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 a Hierarchical Grid bug (#17295) where copying/selecting a cell on an expanded parent row returned the value of the previous row. The root cause was that getSelectedData() used filteredSortedData as the source while cell-selection indexes are based on visible rows (which include expanded child-grid placeholder rows). The fix overrides getSelectedData() in the hierarchical grid to use dataView with null placeholders for child-grid records, keeping index alignment, and narrows the existing index-subtraction branch in extractDataFromSelection so it no longer double-corrects.
Changes:
- Override
getSelectedData()inIgxHierarchicalGridComponentto build a source fromdataViewwithnullfor child-grid placeholder rows. - Restrict the hierarchical-specific row-index adjustment in
extractDataFromSelectionto only apply when the source isfilteredSortedData. - Add a regression unit test reproducing the original copy-from-expanded-row scenario.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.component.ts | Adds getSelectedData override that pads dataView with null placeholders for child-grid records. |
| projects/igniteui-angular/grids/grid/src/grid-base.directive.ts | Gates the hierarchical row-index subtraction logic so it only runs when the source is filteredSortedData. |
| projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.integration.spec.ts | Adds regression test verifying selected data on an expanded parent row returns the correct value. |
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)