fix(grid): Setup columns when autoGenerate is set after the grid data - 22.1.x - #17552
Merged
Conversation
kdinev
approved these changes
Aug 31, 2026
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Derived ngOnChanges overrides in pivot grid and row-island don’t call super.ngOnChanges, which can bypass the new base autoGenerate handling and break the intended fix.
Pull request overview
This PR addresses a grid rendering bug where setting data before toggling autoGenerate after initialization can result in no columns/data being rendered, by ensuring column setup is triggered when autoGenerate changes post-init.
Changes:
- Added
OnChangeshandling inIgxGridBaseDirectiveto callsetupColumns()whenautoGeneratebecomestrueafter data is present. - Adjusted column change handling subscription to be set up during
ngAfterContentInit. - Added a unit test covering the “data first, autoGenerate later” initialization scenario.
File summaries
| File | Description |
|---|---|
| projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts | Marks ngOnChanges as override (but currently misses delegating to base). |
| projects/igniteui-angular/grids/hierarchical-grid/src/row-island.component.ts | Marks ngOnChanges as override (but currently misses delegating to base). |
| projects/igniteui-angular/grids/grid/src/grid.component.spec.ts | Adds a regression test for setting autoGenerate after data assignment. |
| projects/igniteui-angular/grids/grid/src/grid-base.directive.ts | Implements OnChanges, decorates autoGenerate with @WatchChanges(), and triggers setupColumns() when toggled after init. |
| projects/igniteui-angular/grids/core/src/watch-changes.ts | Tightens @WatchChanges() behavior to avoid calling ngOnChanges during initialization. |
Review details
Suppressed comments (2)
projects/igniteui-angular/grids/hierarchical-grid/src/row-island.component.ts:442
- This
ngOnChangesoverride does not callsuper.ngOnChanges(...). BecauseIgxHierarchicalGridBaseDirectiveextendsIgxGridBaseDirective(which now containsngOnChangeslogic forautoGenerate), not delegating to the base class can prevent column setup whenautoGenerateis toggled after data assignment.
public override ngOnChanges(changes: SimpleChanges<IgxRowIslandComponent>) {
this.layoutChange.emit(changes);
if (!this.isInit) {
this.initialChanges.push(changes);
}
}
projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts:1142
- This override does not call
super.ngOnChanges(...). SinceIgxGridBaseDirectivenow implementsngOnChanges(including autoGenerate-related setup), skipping the base implementation can break inherited behavior inIgxPivotGridComponentwhen inputs likeautoGeneratechange after data is set.
public override ngOnChanges(changes: SimpleChanges<IgxPivotGridComponent>) {
if (changes.superCompactMode && !changes.superCompactMode.isFirstChange()) {
this._shouldUpdateSizes = true;
resizeObservable(this.verticalScrollContainer.displayContainer!).pipe(take(1), takeUntil(this.destroy$)).subscribe(() => this.resizeNotify.next());
}
}
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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 #16830
Description
Motivation / Context
Type of Change (check all that apply):
Component(s) / Area(s) Affected:
How Has This Been Tested?
Test Configuration:
Screenshots / Recordings
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)