fix ajax url() context. fixes #895
This commit is contained in:
parent
6b65976e17
commit
9bf4614cd5
@ -411,21 +411,21 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
tmp = data;
|
tmp = data;
|
||||||
data = { results: tmp };
|
data = { results: tmp };
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($.isFunction(data) === false) {
|
if ($.isFunction(data) === false) {
|
||||||
tmp = data;
|
tmp = data;
|
||||||
data = function() { return tmp; };
|
data = function() { return tmp; };
|
||||||
}
|
}
|
||||||
|
|
||||||
var dataItem = data();
|
var dataItem = data();
|
||||||
if (dataItem.text) {
|
if (dataItem.text) {
|
||||||
text = dataItem.text;
|
text = dataItem.text;
|
||||||
// if text is not a function we assume it to be a key name
|
// if text is not a function we assume it to be a key name
|
||||||
if (!$.isFunction(text)) {
|
if (!$.isFunction(text)) {
|
||||||
dataText = data.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
|
dataText = data.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
|
||||||
text = function (item) { return item[dataText]; };
|
text = function (item) { return item[dataText]; };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (query) {
|
return function (query) {
|
||||||
var t = query.term, filtered = { results: [] }, process;
|
var t = query.term, filtered = { results: [] }, process;
|
||||||
@ -838,7 +838,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
if (ajaxUrl && ajaxUrl.length > 0) {
|
if (ajaxUrl && ajaxUrl.length > 0) {
|
||||||
opts.ajax.url = ajaxUrl;
|
opts.ajax.url = ajaxUrl;
|
||||||
}
|
}
|
||||||
opts.query = ajax(opts.ajax);
|
opts.query = ajax.call(opts.element, opts.ajax);
|
||||||
} else if ("data" in opts) {
|
} else if ("data" in opts) {
|
||||||
opts.query = local(opts.data);
|
opts.query = local(opts.data);
|
||||||
} else if ("tags" in opts) {
|
} else if ("tags" in opts) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user