From 1eae40c65b90896f72a9c4d8547fc3d8a98ea539 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 6 Feb 2017 14:22:34 +0300 Subject: [PATCH] [SSE] Fix Bug 19709. --- .../main/app/controller/Statusbar.js | 6 ++++ .../main/app/controller/Toolbar.js | 1 + .../main/app/template/StatusBar.template | 4 +++ .../main/app/view/Statusbar.js | 30 ++++++++++++++++++- .../main/resources/less/statusbar.less | 3 +- 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index 777ad7f0e..61dea8682 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -104,6 +104,7 @@ define([ this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onWorksheetLocked, this)); /** coauthoring end **/ this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this)); + this.api.asc_registerCallback('asc_onFilterInfo', _.bind(this.onApiFilterInfo , this)); this.statusbar.setApi(api); }, @@ -185,6 +186,11 @@ define([ this.statusbar.updateTabbarBorders(); }, + onApiFilterInfo: function(countFilter, countRecords) { + this.statusbar.setFilteredInfo(countFilter, countRecords); + this.statusbar.updateTabbarBorders(); + }, + onApiEditCell: function(state) { var disableAdd = (state == Asc.c_oAscCellEditorState.editFormula), disable = (state != Asc.c_oAscCellEditorState.editEnd), diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index f9460c963..3a842b476 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1936,6 +1936,7 @@ define([ need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true); toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array:[toolbar.btnClearAutofilter,toolbar.mnuitemClearFilter]}); + this.getApplication().getController('Statusbar').onApiFilterInfo(!need_disable); this._state.multiselect = info.asc_getFlags().asc_getMultiselect(); toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink]}); diff --git a/apps/spreadsheeteditor/main/app/template/StatusBar.template b/apps/spreadsheeteditor/main/app/template/StatusBar.template index edf69d514..adb030fc1 100644 --- a/apps/spreadsheeteditor/main/app/template/StatusBar.template +++ b/apps/spreadsheeteditor/main/app/template/StatusBar.template @@ -39,6 +39,10 @@ +
+
+ +
diff --git a/apps/spreadsheeteditor/main/app/view/Statusbar.js b/apps/spreadsheeteditor/main/app/view/Statusbar.js index d3c237237..2d2bc1859 100644 --- a/apps/spreadsheeteditor/main/app/view/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/view/Statusbar.js @@ -323,6 +323,10 @@ define([ this.labelAverage = $('#status-math-average', this.boxMath); this.boxMath.hide(); + this.boxFiltered = $('#status-filtered-box', this.el); + this.labelFiltered = $('#status-filtered-records', this.boxFiltered); + this.boxFiltered.hide(); + this.boxZoom = $('#status-zoom-box', this.el); this.boxZoom.find('.separator').css('border-left-color','transparent'); @@ -426,6 +430,23 @@ define([ },30); }, + setFilteredInfo: function(countFilter, countRecords) { + if (countFilter>0 && countRecords>0) {//filter is applied + if (!this.boxFiltered.is(':visible')) this.boxFiltered.show(); + this.labelFiltered.text(Common.Utils.String.format(this.filteredRecordsText, countFilter, countRecords)); + } else if (countFilter) {// filter mode + if (!this.boxFiltered.is(':visible')) this.boxFiltered.show(); + this.labelFiltered.text(this.filteredText); + } else { + if (this.boxFiltered.is(':visible')) this.boxFiltered.hide(); + } + + var me = this; + _.delay(function(){ + me.onTabInvisible(undefined, me.tabbar.checkInvisible(true)); + },30); + }, + /** coauthoring begin **/ onUsersClick: function() { this.panelUsers.removeClass('open'); @@ -600,6 +621,11 @@ define([ visible = true; } + if (this.boxFiltered.is(':visible')) { + right += parseInt(this.boxFiltered.css('width')); + visible = true; + } + if (this.panelUsers.is(':visible')) { right += parseInt(this.panelUsers.css('width')); visible = true; @@ -645,7 +671,9 @@ define([ tipUsers : 'Document is currently being edited by several users.', tipAccessRights : 'Manage document access rights', tipViewUsers : 'View users and manage document access rights', - txAccessRights : 'Change access rights' + txAccessRights : 'Change access rights', + filteredRecordsText : '{0} of {1} records filtered', + filteredText : 'Filter mode' }, SSE.Views.Statusbar || {})); diff --git a/apps/spreadsheeteditor/main/resources/less/statusbar.less b/apps/spreadsheeteditor/main/resources/less/statusbar.less index e2b56f51d..bbee52d60 100644 --- a/apps/spreadsheeteditor/main/resources/less/statusbar.less +++ b/apps/spreadsheeteditor/main/resources/less/statusbar.less @@ -119,7 +119,8 @@ height: 25px; } - #status-math-box { + #status-math-box, + #status-filtered-box { float: right; padding-top: 6px; padding-right: 14px;