Skip to content

fix(grid): Setup columns when autoGenerate is set after the grid data#17004

Open
mddragnev wants to merge 2 commits into21.1.xfrom
mdragnev/fix-16830-21.1.x
Open

fix(grid): Setup columns when autoGenerate is set after the grid data#17004
mddragnev wants to merge 2 commits into21.1.xfrom
mdragnev/fix-16830-21.1.x

Conversation

@mddragnev
Copy link
Copy Markdown
Member

Closes #16830

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

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

@mddragnev mddragnev requested a review from damyanpetev March 6, 2026 14:34
@MayaKirova MayaKirova added 💥 status: in-test PRs currently being tested ✅ status: verified Applies to PRs that have passed manual verification and removed 💥 status: in-test PRs currently being tested labels Mar 10, 2026
Copilot AI review requested due to automatic review settings April 20, 2026 15:19
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 an issue where grids fail to render data when data is assigned first and autoGenerate is enabled afterward, by ensuring columns are generated in that sequence.

Changes:

  • Add IgxGridBaseDirective.ngOnChanges handling for autoGenerate toggled after data is already present.
  • Ensure autoGenerate input triggers change handling via @WatchChanges(), and adjust WatchChanges initialization guard.
  • Add a unit test covering the “set data first, then set autoGenerate” scenario.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts Adds OnChanges support and generates columns when autoGenerate becomes true after data is set; adjusts column change subscription placement.
projects/igniteui-angular/grids/core/src/watch-changes.ts Tightens initialization check before manually invoking ngOnChanges from the decorator.
projects/igniteui-angular/grids/grid/src/grid.component.spec.ts Adds regression test for setting autoGenerate after data.
projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts Marks ngOnChanges as override after base introduces ngOnChanges.
projects/igniteui-angular/grids/hierarchical-grid/src/row-island.component.ts Marks ngOnChanges as override after base introduces ngOnChanges.
Comments suppressed due to low confidence (2)

projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts:1027

  • IgxPivotGridComponent overrides ngOnChanges but does not call super.ngOnChanges(changes). Since IgxGridBaseDirective now implements ngOnChanges (and contains the autoGenerate fix), the base behavior will be skipped for pivot grids. Consider calling super.ngOnChanges(changes) (typically first) unless intentionally opting out of the base handling.
    public override ngOnChanges(changes: SimpleChanges) {
        if (changes.superCompactMode && !changes.superCompactMode.isFirstChange()) {
            this._shouldUpdateSizes = true;
            resizeObservable(this.verticalScrollContainer.displayContainer).pipe(take(1), takeUntil(this.destroy$)).subscribe(() => this.resizeNotify.next());
        }

projects/igniteui-angular/grids/hierarchical-grid/src/row-island.component.ts:479

  • IgxRowIslandComponent overrides ngOnChanges but does not call super.ngOnChanges(changes). With the new IgxGridBaseDirective.ngOnChanges implementation, this will bypass base input-change handling (including the new autoGenerate behavior) for row islands. Call super.ngOnChanges(changes) unless you explicitly want to suppress the base logic.
    public override ngOnChanges(changes) {
        this.layoutChange.emit(changes);
        if (!this.isInit) {
            this.initialChanges.push(changes);
        }

Comment thread projects/igniteui-angular/grids/core/src/watch-changes.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grid version: 21.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.

4 participants