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) {
if (opts.textsearch && opts.textsearch.length) {
if (!this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, opts.matchword)) {
var me = this;
Common.UI.info({
msg: this.textNoTextFound,
var me = this;
this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) {
!resultCount && Common.UI.info({
msg: me.textNoTextFound,
callback: function() {
me.dlgSearch.focus();
}
});
}
});
}
},

View file

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

View file

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

View file

@ -88,9 +88,10 @@ const Search = withTranslation()(props => {
f7.popover.close('.document-menu.modal-in', false);
if (params.find && params.find.length) {
if (!api.findText(params.find, params.forward, params.caseSensitive) ) {
f7.dialog.alert(null, _t.textNoTextFound);
}
api.asc_findText(params.find, params.forward, params.caseSensitive, function(resultCount) {
!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_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;
Common.UI.info({
msg: this.textNoTextFound,
var me = this;
this.api.asc_findText(options, function(resultCount) {
!resultCount && Common.UI.info({
msg: me.textNoTextFound,
callback: function() {
me.dlgSearch.focus();
}
});
}
});
// }
},

View file

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