Merge pull request #2303 from snrmwg/master
Query term in tags function in select2 3.4 #2141
This commit is contained in:
commit
086f977b9a
@ -538,6 +538,8 @@ 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);
|
||||||
|
if ($.isArray(result)) {
|
||||||
$(isFunc ? data() : data).each(function () {
|
$(isFunc ? data() : data).each(function () {
|
||||||
var isObject = this.text !== undefined,
|
var isObject = this.text !== undefined,
|
||||||
text = isObject ? this.text : this;
|
text = isObject ? this.text : this;
|
||||||
@ -546,6 +548,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
query.callback(filtered);
|
query.callback(filtered);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user