diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index 80c9e29a4..343aae72a 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -120,9 +120,9 @@ define([ {array: [this.view.btnCloseView]}); }, - onFreeze: function(state) { + onFreeze: function(type) { if (this.api) { - this.api.asc_freezePane(); + this.api.asc_freezePane(type); } Common.NotificationCenter.trigger('edit:complete', this.view); }, @@ -206,7 +206,7 @@ define([ var params = this.api.asc_getSheetViewSettings(); this.view.chHeadings.setValue(!!params.asc_getShowRowColHeaders(), true); this.view.chGridlines.setValue(!!params.asc_getShowGridLines(), true); - this.view.btnFreezePanes.toggle(!!params.asc_getIsFreezePane(), true); + this.view.btnFreezePanes.menu.items && this.view.btnFreezePanes.menu.items[0].setCaption(!!params.asc_getIsFreezePane() ? this.view.textUnFreeze : this.view.capBtnFreeze); var currentSheet = this.api.asc_getActiveWorksheetIndex(); this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet)); diff --git a/apps/spreadsheeteditor/main/app/view/ViewTab.js b/apps/spreadsheeteditor/main/app/view/ViewTab.js index e22dcfe16..95586474d 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/view/ViewTab.js @@ -57,8 +57,8 @@ define([ }); } - me.btnFreezePanes.on('click', function (btn, e) { - me.fireEvent('viewtab:freeze', [btn.pressed]); + me.btnFreezePanes.menu.on('item:click', function (menu, item, e) { + me.fireEvent('viewtab:freeze', [item.value]); }); this.chFormula.on('change', function (field, value) { me.fireEvent('viewtab:formula', [0, value]); @@ -125,8 +125,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-freeze-panes', caption: this.capBtnFreeze, - split: false, - enableToggle: true, + menu: true, lock: [_set.sheetLock, _set.lostConnect, _set.coAuth] }); this.lockedControls.push(this.btnFreezePanes); @@ -196,6 +195,22 @@ define([ me.btnCreateView.updateHint(me.tipCreate); me.btnCloseView.updateHint(me.tipClose); } + me.btnFreezePanes.setMenu(new Common.UI.Menu({ + items: [ + { + caption: me.toolbar && me.toolbar.api && !!me.toolbar.api.asc_getSheetViewSettings().asc_getIsFreezePane() ? me.textUnFreeze : me.capBtnFreeze, + value: undefined + }, + { + caption: me.textFreezeRow, + value: Asc.c_oAscFrozenPaneAddType.firstRow + }, + { + caption: me.textFreezeCol, + value: Asc.c_oAscFrozenPaneAddType.firstCol + } + ] + })); me.btnFreezePanes.updateHint(me.tipFreeze); setEvents.call(me); @@ -315,7 +330,10 @@ define([ textClose: 'Close', textFormula: 'Formula bar', textHeadings: 'Headings', - textGridlines: 'Gridlines' + textGridlines: 'Gridlines', + textFreezeRow: 'Freeze Top Row', + textFreezeCol: 'Freeze Top Column', + textUnFreeze: 'Unfreeze Panes' } }()), SSE.Views.ViewTab || {})); }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 5f151593a..843d560c9 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -3411,5 +3411,8 @@ "SSE.Views.ViewTab.tipClose": "Close sheet view", "SSE.Views.ViewTab.tipCreate": "Create sheet view", "SSE.Views.ViewTab.tipFreeze": "Freeze panes", - "SSE.Views.ViewTab.tipSheetView": "Sheet view" + "SSE.Views.ViewTab.tipSheetView": "Sheet view", + "SSE.Views.ViewTab.textFreezeRow": "Freeze Top Row", + "SSE.Views.ViewTab.textFreezeCol": "Freeze Top Column", + "SSE.Views.ViewTab.textUnFreeze": "Unfreeze Panes" } \ No newline at end of file