From 16cd61a4c275ddfccef8a20553216c780e3d7e60 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 4 Oct 2019 18:01:56 +0300 Subject: [PATCH] [SSE] Refactoring pivot table tab --- .../main/app/controller/PivotTable.js | 4 +- .../main/app/view/CreatePivotDialog.js | 2 +- .../main/app/view/PivotTable.js | 70 ++++++++++--------- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index 6c66bc404..ae385a981 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -81,15 +81,13 @@ define([ }; this._originalProps = null; - this.view = this.createView('PivotTable'); - Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this)); }, setConfig: function (data, api) { + this.view = this.createView('PivotTable'); this.setApi(api); - if (data) { this.sdkViewName = data['sdkviewname'] || this.sdkViewName; } diff --git a/apps/spreadsheeteditor/main/app/view/CreatePivotDialog.js b/apps/spreadsheeteditor/main/app/view/CreatePivotDialog.js index 2aca486e8..dfcff0c75 100644 --- a/apps/spreadsheeteditor/main/app/view/CreatePivotDialog.js +++ b/apps/spreadsheeteditor/main/app/view/CreatePivotDialog.js @@ -96,7 +96,7 @@ define([ '', '', '', - '', + '' ].join('') }, options); diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index 802425a39..43db393e4 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -185,7 +185,6 @@ define([ disabled : false, lock : [_set.lostConnect, _set.coAuth, _set.editPivot] }); - // this.lockedControls.push(this.btnAddPivot); this.btnPivotLayout = new Common.UI.Button({ cls : 'btn-toolbar x-huge icon-top', @@ -193,16 +192,7 @@ define([ caption : this.capLayout, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot], - menu : new Common.UI.Menu({ - items: [ - { caption: this.mniLayoutCompact, value: 0 }, - { caption: this.mniLayoutOutline, value: 1 }, - { caption: this.mniLayoutTabular, value: 2 }, - { caption: '--' }, - { caption: this.mniLayoutRepeat, value: 3 }, - { caption: this.mniLayoutNoRepeat, value: 4 } - ] - }) + menu : true }); this.lockedControls.push(this.btnPivotLayout); @@ -212,12 +202,7 @@ define([ caption : this.capBlankRows, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot], - menu : new Common.UI.Menu({ - items: [ - { caption: this.mniInsertBlankLine, value: 'insert' }, - { caption: this.mniRemoveBlankLine, value: 'remove' } - ] - }) + menu : true }); this.lockedControls.push(this.btnPivotBlankRows); @@ -227,13 +212,7 @@ define([ caption : this.capSubtotals, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot], - menu : new Common.UI.Menu({ - items: [ - { caption: this.mniNoSubtotals, value: 0 }, - { caption: this.mniBottomSubtotals, value: 1 }, - { caption: this.mniTopSubtotals, value: 2 } - ] - }) + menu : true }); this.lockedControls.push(this.btnPivotSubtotals); @@ -243,14 +222,7 @@ define([ caption : this.capGrandTotals, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot], - menu : new Common.UI.Menu({ - items: [ - { caption: this.mniOffTotals, value: 0 }, - { caption: this.mniOnTotals, value: 1 }, - { caption: this.mniOnRowsTotals, value: 2 }, - { caption: this.mniOnColumnsTotals, value: 3 } - ] - }) + menu : true }); this.lockedControls.push(this.btnPivotGrandTotals); @@ -300,9 +272,43 @@ define([ me.btnRefreshPivot.updateHint(me.tipRefresh); me.btnSelectPivot.updateHint(me.tipSelect); me.btnPivotLayout.updateHint(me.capLayout); + me.btnPivotLayout.setMenu(new Common.UI.Menu({ + items: [ + { caption: me.mniLayoutCompact, value: 0 }, + { caption: me.mniLayoutOutline, value: 1 }, + { caption: me.mniLayoutTabular, value: 2 }, + { caption: '--' }, + { caption: me.mniLayoutRepeat, value: 3 }, + { caption: me.mniLayoutNoRepeat, value: 4 } + ] + })); + me.btnPivotBlankRows.updateHint(me.capBlankRows); + me.btnPivotBlankRows.setMenu( new Common.UI.Menu({ + items: [ + { caption: me.mniInsertBlankLine, value: 'insert' }, + { caption: me.mniRemoveBlankLine, value: 'remove' } + ] + })); + me.btnPivotSubtotals.updateHint(me.tipSubtotals); + me.btnPivotSubtotals.setMenu(new Common.UI.Menu({ + items: [ + { caption: me.mniNoSubtotals, value: 0 }, + { caption: me.mniBottomSubtotals, value: 1 }, + { caption: me.mniTopSubtotals, value: 2 } + ] + })); + me.btnPivotGrandTotals.updateHint(me.tipGrandTotals); + me.btnPivotGrandTotals.setMenu(new Common.UI.Menu({ + items: [ + { caption: me.mniOffTotals, value: 0 }, + { caption: me.mniOnTotals, value: 1 }, + { caption: me.mniOnRowsTotals, value: 2 }, + { caption: me.mniOnColumnsTotals, value: 3 } + ] + })); setEvents.call(me); });