Restore code for showing asyc the autocomplete.

This commit is contained in:
Israel Garcia 2017-06-19 12:39:15 -04:00
parent 4036f5cd28
commit f71aa6c5b9
1 changed files with 16 additions and 13 deletions

View File

@ -1115,20 +1115,23 @@ treemode._onKeyDown = function (event) {
(this.options.autocomplete.applyTo.indexOf('field') >= 0 && jsonElementType == "field")) { (this.options.autocomplete.applyTo.indexOf('field') >= 0 && jsonElementType == "field")) {
var node = Node.getNodeFromTarget(event.target); var node = Node.getNodeFromTarget(event.target);
// Activate autocomplete // Activate autocomplete
if (event.target.innerText.length > 0) { setTimeout(function (hnode, element) {
var result = this.options.autocomplete.getOptions(this.autocomplete, node, event.target.innerText, jsonElementType); if (element.innerText.length > 0) {
if (typeof result.then === 'function') { var result = this.options.autocomplete.getOptions(this.autocomplete, hnode, element.innerText, jsonElementType);
// probably a promise if (typeof result.then === 'function') {
if (result.then(function (options) { // probably a promise
this.autocomplete.show(event.target, options); if (result.then(function (options) {
}.bind(this))); this.autocomplete.show(element, options);
} else { }.bind(this)));
// definitely not a promise } else {
this.autocomplete.show(event.target, result); // definitely not a promise
this.autocomplete.show(element, result);
}
} }
} else
else this.autocomplete.hideDropDown();
this.autocomplete.hideDropDown();
}.bind(this, node, event.target), 50);
} }
} }
} }