diff --git a/apps/common/main/lib/component/SideMenu.js b/apps/common/main/lib/component/SideMenu.js index a965cdc53e..0b62a5964a 100644 --- a/apps/common/main/lib/component/SideMenu.js +++ b/apps/common/main/lib/component/SideMenu.js @@ -164,6 +164,13 @@ define([ } }, + clearMoreButton: function() { + this.buttons && this.buttons.forEach(function (btn) { + btn.cmpEl.show(); + }); + this.btnMore.hide(); + }, + onMenuMore: function (menu, item) { var btn = this.buttons[item.value]; if (btn.cmpEl.prop('id') !== 'left-btn-support') @@ -190,7 +197,7 @@ define([ setDisabledMoreMenuItem: function (btn, disabled) { if (this.btnMore && !btn.cmpEl.is(':visible')) { var index =_.indexOf(this.buttons, btn), - item = _.findWhere(this.btnMore.menu.items, {value: index}) + item = _.findWhere(this.btnMore.menu.items, {value: index}); item && item.setDisabled(disabled); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index 51ae4221f1..07e8ce71a6 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -52,7 +52,7 @@ define([ initialize: function() { this.editMode = true; - this._state = {wsLock: false, wsProps: []}; + this._state = {wsLock: false, wsProps: [], inPivot: false}; this.addListeners({ 'Toolbar': { @@ -252,11 +252,20 @@ define([ this._settings[settingsType].btn.updateHint(this.rightmenu.txtSparklineSettings); } - if (pivotInfo && this.rightmenu.mode.canFeaturePivot) { + if (this.rightmenu.mode.canFeaturePivot) { settingsType = Common.Utils.documentSettingsType.Pivot; - this._settings[settingsType].props = pivotInfo; - this._settings[settingsType].locked = isPivotLocked; // disable pivot settings - this._settings[settingsType].hidden = 0; + if (pivotInfo) { + this._settings[settingsType].props = pivotInfo; + this._settings[settingsType].locked = isPivotLocked; // disable pivot settings + this._settings[settingsType].hidden = 0; + } + if (this._state.inPivot !== !this._settings[settingsType].hidden) { + this.rightmenu.clearMoreButton(); + this.rightmenu.btnPivot.setVisible(!this._settings[settingsType].hidden); + this.rightmenu.setButtons(); + this.rightmenu.setMoreButton(); + this._state.inPivot = !this._settings[settingsType].hidden; + } } if (SelectedObjects.length<=0 && cellInfo) { // cell is selected diff --git a/apps/spreadsheeteditor/main/app/template/RightMenu.template b/apps/spreadsheeteditor/main/app/template/RightMenu.template index afee84777b..bcf3190017 100644 --- a/apps/spreadsheeteditor/main/app/template/RightMenu.template +++ b/apps/spreadsheeteditor/main/app/template/RightMenu.template @@ -30,9 +30,9 @@ - +
\ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/RightMenu.js b/apps/spreadsheeteditor/main/app/view/RightMenu.js index 0eafd7da6c..178c660e4f 100644 --- a/apps/spreadsheeteditor/main/app/view/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/view/RightMenu.js @@ -241,9 +241,6 @@ define([ this.signatureSettings = new SSE.Views.SignatureSettings(); } - if (mode && mode.canFeaturePivot) - this.btnPivot.setVisible(true); - if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ el: $(this.el).find('.right-panel'), @@ -368,7 +365,7 @@ define([ }, setButtons: function () { - var allButtons = [this.btnCell, this.btnTable, this.btnShape, this.btnImage, this.btnChart, this.btnText, this.btnTextArt, this.btnPivot, this.btnSlicer, this.btnSignature]; + var allButtons = [this.btnCell, this.btnTable, this.btnShape, this.btnImage, this.btnChart, this.btnText, this.btnTextArt, this.btnSlicer, this.btnSignature, this.btnPivot]; Common.UI.SideMenu.prototype.setButtons.apply(this, [allButtons]); },