diff --git a/apps/spreadsheeteditor/main/app/controller/Search.js b/apps/spreadsheeteditor/main/app/controller/Search.js index f615ab4dc..f830b7c41 100644 --- a/apps/spreadsheeteditor/main/app/controller/Search.js +++ b/apps/spreadsheeteditor/main/app/controller/Search.js @@ -125,6 +125,7 @@ define([ this.api.asc_registerCallback('asc_onRemoveTextAroundSearch', _.bind(this.onApiRemoveTextAroundSearch, this)); this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onActiveSheetChanged, this)); this.api.asc_registerCallback('asc_onModifiedDocument', _.bind(this.onApiModifiedDocument, this)); + this.api.asc_registerCallback('asc_onUpdateSearchElem', _.bind(this.onApiUpdateSearchElem, this)); } return this; }, @@ -475,8 +476,12 @@ define([ var cells = [item.find('.sheet'), item.find('.name'), item.find('.cell'), item.find('.value'), item.find('.formula')], tips = [data[1], data[2], data[3], data[4], data[5]]; cells.forEach(function (el, ind) { + if (el.data('bs.tooltip')) { + el.removeData('bs.tooltip'); + } var tip = tips[ind]; if (tip) { + el.off('mouseenter'); el.one('mouseenter', function () { el.attr('data-toggle', 'tooltip'); el.tooltip({ @@ -592,6 +597,33 @@ define([ return this._state.searchText; }, + onApiUpdateSearchElem: function (data) { // [id, sheet, name, cell, value, formula] + if (this.resultItems && this.resultItems.length > 0) { + var me = this; + data.forEach(function (item) { + var resultItem = _.findWhere(me.resultItems, {id: item[0]}); + if (resultItem) { + resultItem.data = item; + resultItem.el = '