From 973b55315d47d5be02b65e49ef221670f6d742db Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 19 Jan 2017 14:34:37 +0300 Subject: [PATCH] [SSE] FormatSettingsDialog: add custom format to the list of formats. --- .../spreadsheeteditor/main/app/controller/Toolbar.js | 4 +++- .../main/app/view/FormatSettingsDialog.js | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index d50393ace..abce1f904 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -104,6 +104,7 @@ define([ multiselect: false, sparklines_disabled: false, numformattype: undefined, + numformat: undefined, langId: undefined }; @@ -908,7 +909,7 @@ define([ } Common.NotificationCenter.trigger('edit:complete', me.toolbar); }, - props : {formatType: me._state.numformattype, langId: value} + props : {formatType: me._state.numformattype, format: me._state.numformat, langId: value} })).show(); Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Number Format'); @@ -1935,6 +1936,7 @@ define([ } val = info.asc_getNumFormatType(); + this._state.numformat = info.asc_getNumFormat(); if (this._state.numformattype !== val) { toolbar.cmbNumberFormat.setValue(val, toolbar.txtCustom); this._state.numformattype = val; diff --git a/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js index 33012cc72..cb07e282c 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js @@ -162,6 +162,7 @@ define([ this.FormatType = Asc.c_oAscNumFormatType.General; this.Format = "General"; + this.CustomFormat = null; }, render: function() { @@ -262,6 +263,9 @@ define([ this.langId = props.langId; this.cmbFormat.setValue(props.formatType, this.txtCustom); + if ((props.formatType == Asc.c_oAscNumFormatType.Custom) && props.format) + this.CustomFormat = this.Format = props.format; + this.onFormatSelect(this.cmbFormat, this.cmbFormat.getSelectedRecord()); // for fraction - if props.format not in cmbType - setValue(this.txtCustom) // for date/time - if props.format not in cmbType - setValue(this.api.asc_getLocaleExample(props.format, 37973)) @@ -433,10 +437,16 @@ define([ info.asc_setSymbol(this.langId); var formatsarr = this.api.asc_getFormatCells(info), - data = []; + data = [], + isCustom = (this.CustomFormat) ? true : false; formatsarr.forEach(function(item) { data.push({value: item, displayValue: item}); + if (me.CustomFormat == item) + isCustom = false; }); + if (isCustom) { + data.push({value: this.CustomFormat, displayValue: this.CustomFormat}); + } this.cmbCode.setData(data); this.cmbCode.setValue(this.Format); }