Skip to content

Commit

Permalink
Merge pull request #10189 from IgniteUI/rkaraivanov/summaries-setter-11
Browse files Browse the repository at this point in the history
fix(grid): Check summary reference
  • Loading branch information
kdinev authored Sep 27, 2021
2 parents 50a18ea + 770a721 commit 71f6c6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions projects/igniteui-angular/src/lib/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ export const yieldingLoop = (count: number, chunkSize: number, callback: (index:
chunk();
};

export const isConstructor = (ref: any) => typeof ref === 'function' && Boolean(ref.prototype) && Boolean(ref.prototype.constructor);

export const mkenum = <T extends { [index: string]: U }, U extends string>(x: T) => x;

export const reverseAnimationResolver = (animation: AnimationReferenceMetadata): AnimationReferenceMetadata =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { GridType } from '../common/grid.interface';
import { IgxGridHeaderComponent } from '../headers/grid-header.component';
import { IgxGridFilteringCellComponent } from '../filtering/base/grid-filtering-cell.component';
import { IgxGridHeaderGroupComponent } from '../headers/grid-header-group.component';
import { getNodeSizeViaRange } from '../../core/utils';
import { getNodeSizeViaRange, isConstructor } from '../../core/utils';
import { IgxSummaryOperand, IgxNumberSummaryOperand, IgxDateSummaryOperand,
IgxCurrencySummaryOperand, IgxPercentSummaryOperand } from '../summaries/grid-summary';
import {
Expand Down Expand Up @@ -954,7 +954,9 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy {
* @memberof IgxColumnComponent
*/
public set summaries(classRef: any) {
this._summaries = new classRef();
if (isConstructor(classRef)) {
this._summaries = new classRef();
}

if (this.grid) {
this.grid.summaryService.removeSummariesCachePerColumn(this.field);
Expand Down

0 comments on commit 71f6c6e

Please sign in to comment.