From 4df5e2f0fea041ee888662d2c4d314d52bc58cae Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 Sep 2023 17:26:28 +0300 Subject: [PATCH] [SSE] Fix number format for pivot table --- .../main/app/controller/DocumentHolder.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 55b9b240ce..70b712ecff 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -4724,10 +4724,17 @@ define([ } }, + isPivotNumberFormat: function() { + if (this.propsPivot && this.propsPivot.originalProps && this.propsPivot.field) { + return (this.propsPivot.originalProps.asc_getFieldGroupType(this.propsPivot.pivotIndex) !== Asc.c_oAscGroupType.Text); + } + return false; + }, + onNumberFormatSelect: function(menu, item) { if (item.value !== undefined && item.value !== 'advanced') { if (this.api) - if (this.propsPivot && this.propsPivot.originalProps && this.propsPivot.field) { + if (this.isPivotNumberFormat()) { var field = (this.propsPivot.fieldType === 2) ? new Asc.CT_DataField() : new Asc.CT_PivotField(); field.asc_setNumFormat(item.options.format); this.propsPivot.field.asc_set(this.api, this.propsPivot.originalProps, (this.propsPivot.fieldType === 2) ? this.propsPivot.index : this.propsPivot.pivotIndex, field); @@ -4746,7 +4753,7 @@ define([ api: me.api, handler: function(result, settings) { if (settings) { - if (me.propsPivot && me.propsPivot.originalProps && me.propsPivot.field) { + if (me.isPivotNumberFormat()) { var field = (me.propsPivot.fieldType === 2) ? new Asc.CT_DataField() : new Asc.CT_PivotField(); field.asc_setNumFormat(settings.format); me.propsPivot.field.asc_set(me.api, me.propsPivot.originalProps, (me.propsPivot.fieldType === 2) ? me.propsPivot.index : me.propsPivot.pivotIndex, field);