From 5f58be5e289cd14fffebb8645053b70d28015536 Mon Sep 17 00:00:00 2001 From: skrustev Date: Wed, 8 Jul 2026 09:39:40 +0300 Subject: [PATCH 1/2] fix(pivotGrid): Set pivot date dimension locale data to avoid performance drops. --- .../grids/core/src/pivot-grid-dimensions.ts | 4 ++- .../pivot-grid/src/pivot-grid.component.ts | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/projects/igniteui-angular/grids/core/src/pivot-grid-dimensions.ts b/projects/igniteui-angular/grids/core/src/pivot-grid-dimensions.ts index 96efe72ff2a..a0ee52c9459 100644 --- a/projects/igniteui-angular/grids/core/src/pivot-grid-dimensions.ts +++ b/projects/igniteui-angular/grids/core/src/pivot-grid-dimensions.ts @@ -106,6 +106,8 @@ export class IgxPivotDateDimension implements IPivotDimension { public childLevel?: IPivotDimension; /** @hidden @internal */ public memberName = 'AllPeriods'; + /** @hidden @internal */ + public locale?: string; public displayName: string; private _resourceStrings: IGridResourceStrings = null; private _baseDimension: IPivotDimension; @@ -145,7 +147,7 @@ export class IgxPivotDateDimension implements IPivotDimension { memberFunction: (rec) => { const recordValue = PivotUtil.extractValueFromDimension(inBaseDimension, rec); const dateValue = recordValue ? getDateFormatter().createDateFromValue(recordValue) : null; - return recordValue ? getDateFormatter().formatDateTime(dateValue, undefined, { month: 'long'}) : rec['Months']; + return recordValue ? getDateFormatter().formatDateTime(dateValue, this.locale, { month: 'long'}) : rec['Months']; }, enabled: true, childLevel: baseDimension diff --git a/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts b/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts index aebbdbb6831..bd27f64e0d2 100644 --- a/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts +++ b/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts @@ -299,6 +299,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni this._pivotConfiguration = value; this.emitInitEvents(this._pivotConfiguration); this.filteringExpressionsTree = PivotUtil.buildExpressionTree(value); + this.setDateDimensionsLocaleData(); if (!this._init) { this.setupColumns(); } @@ -995,6 +996,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni this.setupColumns(); // Bind to onResourceChange after the columns have initialized the first time to avoid premature initialization. onResourceChangeHandle(this.destroy$, () => { + this.setDateDimensionsLocaleData(); // Since the columns are kinda static, due to assigning DisplayName on init, they need to be regenerated. this.setupColumns(); }, this); @@ -2487,6 +2489,35 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni protected trackHorizontalRowGroup = (_index: number, rowGroup: IPivotGridRecord[]) => rowGroup[0]?.dataIndex; + /** + * Sets the locale and resourceStrings data based on the grid's properties for all IgxPivotDateDimensions in the config. + */ + protected setDateDimensionsLocaleData() { + const topDimensions = [...this.columnDimensions, ...this.rowDimensions]; + for (const dim of topDimensions) { + let foundDateDim: IgxPivotDateDimension | undefined; + if (dim instanceof IgxPivotDateDimension) { + foundDateDim = dim; + } else if (dim.childLevel) { + var curChild: IPivotDimension | undefined = dim.childLevel; + while(curChild) { + if (curChild instanceof IgxPivotDateDimension) { + foundDateDim = curChild; + break; + } + curChild = curChild.childLevel; + } + } + + if (foundDateDim) { + foundDateDim.resourceStrings = this.resourceStrings; + if (this.locale) { + foundDateDim.locale = this.locale; + } + } + } + } + /** * @hidden @internal */ From 105284f1bf6f16c2cc002714b5822a06e47bc48d Mon Sep 17 00:00:00 2001 From: skrustev Date: Thu, 16 Jul 2026 10:49:48 +0300 Subject: [PATCH 2/2] fix(pivotGrid): Cover api updated config and filters. --- .../grids/pivot-grid/src/pivot-grid.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts b/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts index bd27f64e0d2..310cfd61468 100644 --- a/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts +++ b/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts @@ -1628,6 +1628,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni * This parameter is optional. If not set it will add it to the end of the collection. */ public insertDimensionAt(dimension: IPivotDimension, targetCollectionType: PivotDimensionType, index?: number) { + this.setDateDimensionsLocaleData([dimension]); const targetCollection = this.getDimensionsByType(targetCollectionType); if (index !== undefined) { targetCollection.splice(index, 0, dimension); @@ -2491,9 +2492,11 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni /** * Sets the locale and resourceStrings data based on the grid's properties for all IgxPivotDateDimensions in the config. + * By default search all dimensions (even not enabled). + * @param entryDimensions Entry dimension on which to check for IgxPivotDateDimension instead of the default. */ - protected setDateDimensionsLocaleData() { - const topDimensions = [...this.columnDimensions, ...this.rowDimensions]; + protected setDateDimensionsLocaleData(entryDimensions?: IPivotDimension[]) { + const topDimensions = entryDimensions ?? [...this.allDimensions]; for (const dim of topDimensions) { let foundDateDim: IgxPivotDateDimension | undefined; if (dim instanceof IgxPivotDateDimension) {