From 6232b1aa1be83c81e0371481ccb6c6bd3f12ebc7 Mon Sep 17 00:00:00 2001 From: xy235 Date: Thu, 6 May 2021 19:56:31 +0200 Subject: [PATCH] Index check for excludedFields When the excluded field is not found in fields, current version incorrectly removes other fields instead --- controls/pivotview/src/base/engine.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/controls/pivotview/src/base/engine.ts b/controls/pivotview/src/base/engine.ts index 08212f375a..f61b91f98a 100644 --- a/controls/pivotview/src/base/engine.ts +++ b/controls/pivotview/src/base/engine.ts @@ -848,9 +848,11 @@ export class PivotEngine { lenE = lenE - 1; while (lenE > -1) { let index: number = this.fields.indexOf(this.excludeFields[lenE]); - this.fields.splice(index, 1); - if (this.fieldList) { - delete this.fieldList[this.excludeFields[lenE]]; + if (index > -1) { + this.fields.splice(index, 1); + if (this.fieldList) { + delete this.fieldList[this.excludeFields[lenE]]; + } } lenE--; } @@ -5707,4 +5709,4 @@ export interface FieldItemInfo { * Specifies the position of the field in the exis. */ position?: number; -} \ No newline at end of file +}