diff --git a/apps/spreadsheeteditor/main/app/controller/Search.js b/apps/spreadsheeteditor/main/app/controller/Search.js index 4f3aa42ca..ff01f85d0 100644 --- a/apps/spreadsheeteditor/main/app/controller/Search.js +++ b/apps/spreadsheeteditor/main/app/controller/Search.js @@ -105,6 +105,7 @@ define([ this.api.asc_registerCallback('asc_onEndTextAroundSearch', _.bind(this.onEndTextAroundSearch, this)); this.api.asc_registerCallback('asc_onGetTextAroundSearchPack', _.bind(this.onApiGetTextAroundSearch, this)); this.api.asc_registerCallback('asc_onRemoveTextAroundSearch', _.bind(this.onApiRemoveTextAroundSearch, this)); + this.api.asc_registerCallback('asc_onSearchEnd', _.bind(this.onApiSearchEnd, this)); } return this; }, @@ -314,9 +315,9 @@ define([ var me = this; if (this.api.isReplaceAll) { if (!found) { - this.allResultsWasRemoved(); + this.removeResultItems(); } else { - !(found-replaced) && this.allResultsWasRemoved(); + !(found-replaced) && this.removeResultItems(); Common.UI.info({ msg: !(found-replaced) ? Common.Utils.String.format(this.textReplaceSuccess,replaced) : Common.Utils.String.format(this.textReplaceSkipped,found-replaced), callback: function() { @@ -337,15 +338,15 @@ define([ options.asc_setScanByRows(this._state.searchByRows); options.asc_setLookIn(this._state.lookInFormulas ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value); if (!this.api.asc_findText(options)) { - this.allResultsWasRemoved(); + this.removeResultItems(); } } }, - allResultsWasRemoved: function () { + removeResultItems: function (type) { this.resultItems = []; this.hideResults(); - this.view.updateResultsNumber(undefined, 0); + this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches //this.view.disableReplaceButtons(true); this._state.currentResult = 0; this._state.resultsNumber = 0; @@ -541,6 +542,10 @@ define([ } }, + onApiSearchEnd: function () { + this.removeResultItems('stop'); + }, + textNoTextFound: 'The data you have been searching for could not be found. Please adjust your search options.', textReplaceSuccess: 'Search has been done. {0} occurrences have been replaced', textReplaceSkipped: 'The replacement has been made. {0} occurrences were skipped.',