Skip to content

fix(grid): Setup columns when autoGenerate is set after the grid data - 22.1.x - #17552

Merged
kdinev merged 7 commits into
22.1.xfrom
mdragnev/fix-16830-22.1.x
Aug 31, 2026
Merged

fix(grid): Setup columns when autoGenerate is set after the grid data - 22.1.x#17552
kdinev merged 7 commits into
22.1.xfrom
mdragnev/fix-16830-22.1.x

Conversation

@mddragnev

Copy link
Copy Markdown
Member

Closes #16830

Description

Motivation / Context

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:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

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

@mddragnev
mddragnev requested a review from kdinev August 31, 2026 08:42
@kdinev kdinev added the ✅ status: verified Applies to PRs that have passed manual verification label Aug 31, 2026
@kdinev
kdinev merged commit 2b5a469 into 22.1.x Aug 31, 2026
5 checks passed
@kdinev
kdinev deleted the mdragnev/fix-16830-22.1.x branch August 31, 2026 09:15
@kdinev
kdinev requested a lite review from Copilot August 31, 2026 09:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 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 OnChanges handling in IgxGridBaseDirective to call setupColumns() when autoGenerate becomes true after 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 ngOnChanges override does not call super.ngOnChanges(...). Because IgxHierarchicalGridBaseDirective extends IgxGridBaseDirective (which now contains ngOnChanges logic for autoGenerate), not delegating to the base class can prevent column setup when autoGenerate is 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(...). Since IgxGridBaseDirective now implements ngOnChanges (including autoGenerate-related setup), skipping the base implementation can break inherited behavior in IgxPivotGridComponent when inputs like autoGenerate change 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.

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

Labels

grid version: 22.1.x ✅ status: verified Applies to PRs that have passed manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants