Skip to content

Commit

Permalink
[common] Fix search for SimpleMenu and ComboBox
Browse files Browse the repository at this point in the history
  • Loading branch information
Basher0303 committed Sep 18, 2024
1 parent 5dc5a2d commit d06391f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions apps/common/main/lib/component/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,13 @@ define([
},

selectCandidate: function() {
var index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
var me = this,
index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
isFirstCharsEqual = re.test(this.store.at(index).get(this.displayField)),
itemCandidate, idxCandidate,
me = this;
isFirstCharsEqual = this.searchFields.some(function(field) {
return re.test(me.store.at(index).get(field));
}),
itemCandidate, idxCandidate;

for (var i=0; i<this.store.length; i++) {
var item = this.store.at(i),
Expand Down
10 changes: 6 additions & 4 deletions apps/common/main/lib/component/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1101,11 +1101,13 @@ define([
},

selectCandidate: function() {
var index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
var me = this,
index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
isFirstCharsEqual = re.test(this.items[index].caption),
itemCandidate, idxCandidate,
me = this;
isFirstCharsEqual = this.options.searchFields.some(function(field) {
return re.test(me.items[index][field]);
}),
itemCandidate, idxCandidate;

for (var i=0; i<this.items.length; i++) {
var item = this.items[i],
Expand Down

0 comments on commit d06391f

Please sign in to comment.