1
0
mirror of synced 2024-11-25 22:36:03 +03:00

Query term in tags function in select2 3.4 #2141

This commit is contained in:
Marc Schneider 2014-05-01 15:35:32 +02:00
parent 514988ee54
commit ca859e4e42

View File

@ -538,9 +538,9 @@ the specific language governing permissions and limitations under the Apache Lic
var isFunc = $.isFunction(data); var isFunc = $.isFunction(data);
return function (query) { return function (query) {
var t = query.term, filtered = {results: []}; var t = query.term, filtered = {results: []};
var result = $(isFunc ? data(query) : data); var result = isFunc ? data(query) : data;
if ($.isArray(result)) { if ($.isArray(result)) {
$(isFunc ? data() : data).each(function () { $(result).each(function () {
var isObject = this.text !== undefined, var isObject = this.text !== undefined,
text = isObject ? this.text : this; text = isObject ? this.text : this;
if (t === "" || query.matcher(t, text)) { if (t === "" || query.matcher(t, text)) {