From 2388608e541c453388a8a52ee400a09d29b20e56 Mon Sep 17 00:00:00 2001 From: Alexei Koshelev Date: Wed, 28 Sep 2022 22:55:30 +0300 Subject: [PATCH] [SSE] Added option to update all pivot tables --- .../main/app/controller/PivotTable.js | 5 +++-- .../main/app/view/PivotTable.js | 18 ++++++++++++++++-- apps/spreadsheeteditor/main/locale/en.json | 2 ++ apps/spreadsheeteditor/main/locale/ru.json | 2 ++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index 148ea6647..c96371903 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -181,9 +181,10 @@ define([ Common.NotificationCenter.trigger('edit:complete', this); }, - onRefreshClick: function(btn, opts){ + onRefreshClick: function(type){ if (this.api) { - this._originalProps.asc_refresh(this.api); + if(type == 'current') this._originalProps.asc_refresh(this.api); + else if(type == 'all') this.api.asc_refreshAllPivots(); } Common.NotificationCenter.trigger('edit:complete', this); }, diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index cc8945d97..bfe698038 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -119,7 +119,11 @@ define([ }); this.btnRefreshPivot.on('click', function (e) { - me.fireEvent('pivottable:refresh'); + me.fireEvent('pivottable:refresh', ['current']); + }); + + this.btnRefreshPivot.menu.on('item:click', function (menu, item, e) { + me.fireEvent('pivottable:refresh', [item.value]); }); this.btnSelectPivot.on('click', function (e) { @@ -254,6 +258,7 @@ define([ iconCls: 'toolbar__icon btn-update', caption: this.txtRefresh, disabled : true, + split : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set.wsLock], dataHint : '1', dataHintDirection: 'bottom', @@ -333,7 +338,6 @@ define([ me.btnsAddPivot.forEach( function(btn) { btn.updateHint(me.tipCreatePivot); }); - me.btnRefreshPivot.updateHint(me.tipRefresh); me.btnSelectPivot.updateHint(me.tipSelect); me.btnPivotLayout.updateHint(me.capLayout); me.btnPivotLayout.setMenu(new Common.UI.Menu({ @@ -374,6 +378,14 @@ define([ ] })); + me.btnRefreshPivot.setMenu(new Common.UI.Menu({ + items: [ + { caption: me.txtRefresh, value: 'current'}, + { caption: me.txtRefreshAll, value: 'all'} + ] + })); + me.btnRefreshPivot.updateHint([me.tipRefreshCurrent, me.tipRefresh]); + setEvents.call(me); }); }, @@ -443,6 +455,8 @@ define([ mniBottomSubtotals: 'Show all Subtotals at Bottom of Group', mniTopSubtotals: 'Show all Subtotals at Top of Group', txtRefresh: 'Refresh', + txtRefreshAll: 'Refresh All', + tipRefreshCurrent: 'Update the information from data source for the current table', tipRefresh: 'Update the information from data source', tipGrandTotals: 'Show or hide grand totals', tipSubtotals: 'Show or hide subtotals', diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index d787dbeb9..84c4f8a42 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2803,6 +2803,7 @@ "SSE.Views.PivotTable.textRowHeader": "Row Headers", "SSE.Views.PivotTable.tipCreatePivot": "Insert Pivot Table", "SSE.Views.PivotTable.tipGrandTotals": "Show or hide grand totals", + "SSE.Views.PivotTable.tipRefreshCurrent": "Update the information from data source for the current table", "SSE.Views.PivotTable.tipRefresh": "Update the information from data source", "SSE.Views.PivotTable.tipSelect": "Select entire pivot table", "SSE.Views.PivotTable.tipSubtotals": "Show or hide subtotals", @@ -2816,6 +2817,7 @@ "SSE.Views.PivotTable.txtGroupPivot_Medium": "Medium", "SSE.Views.PivotTable.txtGroupPivot_Dark": "Dark", "SSE.Views.PivotTable.txtRefresh": "Refresh", + "SSE.Views.PivotTable.txtRefreshAll": "Refresh All", "SSE.Views.PivotTable.txtSelect": "Select", "SSE.Views.PrintSettings.btnDownload": "Save & Download", "SSE.Views.PrintSettings.btnPrint": "Save & Print", diff --git a/apps/spreadsheeteditor/main/locale/ru.json b/apps/spreadsheeteditor/main/locale/ru.json index 1e1416357..2bc8eed74 100644 --- a/apps/spreadsheeteditor/main/locale/ru.json +++ b/apps/spreadsheeteditor/main/locale/ru.json @@ -2781,6 +2781,7 @@ "SSE.Views.PivotTable.textRowHeader": "Заголовки строк", "SSE.Views.PivotTable.tipCreatePivot": "Вставить сводную таблицу", "SSE.Views.PivotTable.tipGrandTotals": "Показать или скрыть общие итоги", + "SSE.Views.PivotTable.tipRefreshCurrent": "Обновить информацию из источника данных для текущей таблицы", "SSE.Views.PivotTable.tipRefresh": "Обновить информацию из источника данных", "SSE.Views.PivotTable.tipSelect": "Выделить всю сводную таблицу", "SSE.Views.PivotTable.tipSubtotals": "Показать или скрыть промежуточные итоги", @@ -2794,6 +2795,7 @@ "SSE.Views.PivotTable.txtGroupPivot_Medium": "Средний", "SSE.Views.PivotTable.txtGroupPivot_Dark": "Темный", "SSE.Views.PivotTable.txtRefresh": "Обновить", + "SSE.Views.PivotTable.txtRefreshAll": "Обновить все", "SSE.Views.PivotTable.txtSelect": "Выделить", "SSE.Views.PrintSettings.btnDownload": "Сохранить и скачать", "SSE.Views.PrintSettings.btnPrint": "Сохранить и напечатать",