From 3a0c941d73d44b015551a4abb9be44bce0d72e3a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 9 Mar 2021 14:43:05 +0300 Subject: [PATCH] [SSE] Fix pivot groups --- .../main/app/controller/DocumentHolder.js | 2 +- .../main/app/view/PivotGroupDialog.js | 52 ++++++++++--------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 5934e1983..d16bbe35f 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -496,7 +496,7 @@ define([ } }); win.show(); - win.setSettings(rangePr, dateTypes, defRangePr, me.permissions.lang); + win.setSettings(rangePr, dateTypes, defRangePr); }, onClear: function(menu, item) { diff --git a/apps/spreadsheeteditor/main/app/view/PivotGroupDialog.js b/apps/spreadsheeteditor/main/app/view/PivotGroupDialog.js index 7fd944f9a..83fba93dd 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotGroupDialog.js +++ b/apps/spreadsheeteditor/main/app/view/PivotGroupDialog.js @@ -131,7 +131,7 @@ define([ labelText: this.textStart }); this.chStart.on('change', function (field, newValue, oldValue, eOpts) { - if (newValue=='checked' && !me.dateTypes && me.defRangePr) { + if (newValue=='checked' && me.defRangePr) { me.inputStart.setValue(me.defRangePr.start); } }); @@ -141,7 +141,7 @@ define([ labelText: this.textEnd }); this.chEnd.on('change', function (field, newValue, oldValue, eOpts) { - if (newValue=='checked' && !me.dateTypes && me.defRangePr) { + if (newValue=='checked' && me.defRangePr) { me.inputEnd.setValue(me.defRangePr.end); } }); @@ -236,18 +236,18 @@ define([ this.btnOk.setDisabled(selected<1); }, - setSettings: function (rangePr, dateTypes, defRangePr, lang) { + setSettings: function (rangePr, dateTypes, defRangePr) { this.$window.find('.group-number').toggleClass('hidden', !!dateTypes); this.$window.find('.group-date').toggleClass('hidden', !dateTypes); if (rangePr) { this.chStart.setValue(rangePr.asc_getAutoStart(), true); this.chEnd.setValue(rangePr.asc_getAutoEnd(), true); - this.inputStart.setValue((dateTypes ? new Date(rangePr.asc_getStartDate()).toLocaleDateString(lang) : rangePr.asc_getStartNum()) || ''); - this.inputEnd.setValue((dateTypes ? new Date(rangePr.asc_getEndDate()).toLocaleDateString(lang) : rangePr.asc_getEndNum()) || ''); + this.inputStart.setValue((dateTypes ? rangePr.asc_getStartDateText() : rangePr.asc_getStartNum()) || ''); + this.inputEnd.setValue((dateTypes ? rangePr.asc_getEndDateText() : rangePr.asc_getEndNum()) || ''); !dateTypes && this.inputBy.setValue(rangePr.asc_getGroupInterval() || ''); this.rangePr = rangePr; if (defRangePr) { - this.defRangePr = {start: defRangePr.asc_getStartNum(), end: defRangePr.asc_getEndNum()}; + this.defRangePr = {start: dateTypes ? defRangePr.asc_getStartDateText() : defRangePr.asc_getStartNum(), end: dateTypes ? defRangePr.asc_getEndDateText() : defRangePr.asc_getEndNum()}; } } if (dateTypes) { @@ -274,8 +274,8 @@ define([ if (this.dateTypes) { this.dateTypes = this.listDate.getSelectedRec().map(function(item){return item.get('type');}); this.rangePr.asc_setGroupInterval(this.spnDays.getNumberValue()); - this.rangePr.asc_setStartDate(new Date(this.inputStart.getValue()).getTime()); - this.rangePr.asc_setEndDate(new Date(this.inputEnd.getValue()).getTime()); + this.rangePr.asc_setStartDateText(this.inputStart.getValue()); + this.rangePr.asc_setEndDateText(this.inputEnd.getValue()); } else { this.rangePr.asc_setStartNum(parseFloat(this.inputStart.getValue().toString().replace(',','.'))); this.rangePr.asc_setEndNum(parseFloat(this.inputEnd.getValue().toString().replace(',','.'))); @@ -288,22 +288,26 @@ define([ isRangeValid: function() { if (this.dateTypes) { - var res1 = new Date(this.inputStart.getValue().toString()).getTime(); - if (isNaN(res1)) { - this.inputStart.showError([this.textError]); - this.inputStart.focus(); - return false; - } - var res2 = new Date(this.inputEnd.getValue().toString()).getTime(); - if (isNaN(res2)) { - this.inputEnd.showError([this.textError]); - this.inputEnd.focus(); - return false; - } - if (res2