Skip to content

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

Open
mddragnev wants to merge 6 commits intomasterfrom
mdragnev/fix-16830-master
Open

fix(grid): Setup columns when autoGenerate is set after the grid data#17227
mddragnev wants to merge 6 commits intomasterfrom
mdragnev/fix-16830-master

Conversation

@mddragnev
Copy link
Copy Markdown
Member

Closes #16830

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

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

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 added the ❌ status: awaiting-test PRs awaiting manual verification label Apr 23, 2026
Copilot AI review requested due to automatic review settings April 23, 2026 06:59
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

This PR addresses a grid rendering issue where setting data first and then enabling autoGenerate after initialization results in no data being rendered (issue #16830).

Changes:

  • Adds ngOnChanges handling in IgxGridBaseDirective to call setupColumns() when autoGenerate is enabled after data is already present.
  • Adjusts some derived grid components to explicitly override ngOnChanges.
  • Adds a unit test covering the “data first, autoGenerate later” 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/pivot-grid/src/pivot-grid.component.ts Marks ngOnChanges as override in pivot grid.
projects/igniteui-angular/grids/hierarchical-grid/src/row-island.component.ts Marks ngOnChanges as override in row island.
projects/igniteui-angular/grids/grid/src/grid.component.spec.ts Adds a unit test for toggling autoGenerate after setting data.
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts Implements OnChanges, wires autoGenerate via @WatchChanges, and triggers setupColumns() on relevant changes.
projects/igniteui-angular/grids/core/src/watch-changes.ts Tweaks WatchChanges to avoid calling ngOnChanges when _init is undefined.
Comments suppressed due to low confidence (2)

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

  • This ngOnChanges now overrides a base implementation (IgxGridBaseDirective.ngOnChanges). Since it doesn’t call super.ngOnChanges(changes), any base change-handling (including the new autoGenerate handling) will be skipped for the pivot grid. Consider calling super.ngOnChanges(changes) to preserve base behavior and future-proof overrides.
    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:475

  • This ngOnChanges now overrides a base implementation (IgxGridBaseDirective.ngOnChanges). Since it doesn’t call super.ngOnChanges(changes), any base change-handling (including the new autoGenerate handling) will be skipped for IgxRowIslandComponent. Consider calling super.ngOnChanges(changes) before emitting layoutChange so base behavior is preserved.
    public override ngOnChanges(changes) {
        this.layoutChange.emit(changes);
        if (!this.isInit) {
            this.initialChanges.push(changes);
        }

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grids: Setting grid data before autoGenerate of columns after the component is initialized does not render any data

3 participants