Use callback in search function

This commit is contained in:
Julia Radzhabova 2022-01-25 15:03:42 +03:00
parent 43b8f75ce1
commit cde9f19aec
6 changed files with 26 additions and 26 deletions

View file

@ -560,15 +560,15 @@ define([
onQuerySearch: function(d, w, opts) { onQuerySearch: function(d, w, opts) {
if (opts.textsearch && opts.textsearch.length) { if (opts.textsearch && opts.textsearch.length) {
if (!this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, opts.matchword)) { var me = this;
var me = this; this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) {
Common.UI.info({ !resultCount && Common.UI.info({
msg: this.textNoTextFound, msg: me.textNoTextFound,
callback: function() { callback: function() {
me.dlgSearch.focus(); me.dlgSearch.focus();
} }
}); });
} });
} }
}, },

View file

@ -111,10 +111,9 @@ const Search = withTranslation()(props => {
if(params.highlight) api.asc_selectSearchingResults(true); if(params.highlight) api.asc_selectSearchingResults(true);
if (!api.asc_findText(params.find, params.forward, params.caseSensitive, params.highlight) ) { api.asc_findText(params.find, params.forward, params.caseSensitive, function(resultCount) {
f7.dialog.alert(null, _t.textNoTextFound); !resultCount && f7.dialog.alert(null, _t.textNoTextFound);
} });
}
}; };
const onchangeSearchQuery = params => { const onchangeSearchQuery = params => {

View file

@ -438,15 +438,15 @@ define([
onQuerySearch: function(d, w, opts) { onQuerySearch: function(d, w, opts) {
if (opts.textsearch && opts.textsearch.length) { if (opts.textsearch && opts.textsearch.length) {
if (!this.api.findText(opts.textsearch, d != 'back', opts.matchcase)) { var me = this;
var me = this; this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) {
Common.UI.info({ !resultCount && Common.UI.info({
msg: this.textNoTextFound, msg: me.textNoTextFound,
callback: function() { callback: function() {
me.dlgSearch.focus(); me.dlgSearch.focus();
} }
}); });
} });
} }
}, },

View file

@ -88,9 +88,10 @@ const Search = withTranslation()(props => {
f7.popover.close('.document-menu.modal-in', false); f7.popover.close('.document-menu.modal-in', false);
if (params.find && params.find.length) { if (params.find && params.find.length) {
if (!api.findText(params.find, params.forward, params.caseSensitive) ) { api.asc_findText(params.find, params.forward, params.caseSensitive, function(resultCount) {
f7.dialog.alert(null, _t.textNoTextFound); !resultCount && f7.dialog.alert(null, _t.textNoTextFound);
} });
} }
}; };

View file

@ -566,15 +566,15 @@ define([
options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked);
options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value); options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value);
if (!this.api.asc_findText(options)) { var me = this;
var me = this; this.api.asc_findText(options, function(resultCount) {
Common.UI.info({ !resultCount && Common.UI.info({
msg: this.textNoTextFound, msg: me.textNoTextFound,
callback: function() { callback: function() {
me.dlgSearch.focus(); me.dlgSearch.focus();
} }
}); });
} });
// } // }
}, },

View file

@ -165,9 +165,9 @@ const Search = withTranslation()(props => {
if (params.highlight) api.asc_selectSearchingResults(true); if (params.highlight) api.asc_selectSearchingResults(true);
if (!api.asc_findText(options)) { api.asc_findText(options, function(resultCount) {
f7.dialog.alert(null, _t.textNoTextFound); !resultCount && f7.dialog.alert(null, _t.textNoTextFound);
} });
} }
}; };