There is an X-Editable (autocomplete) input on a page. When I activate it and press whether ArrowDown or ArrowUp on a keyboard to choose a person, the first person appears, but a hint "Choose from list" appears as well and there is an error in a console: http://joxi.ru/DmBlqXXsNjNpwA
info.js:
updateRefField(data, fieldName, dictionaryName, projectType) {
if (data !== null && !Number.isInteger(data*1)) {
return this.$q.resolve('Choose from list');
}
return this.ProjectService.updateRefField(data, fieldName, dictionaryName, projectType || this.projectType)
.then((res) => {
if ((data === null) && ((fieldName === 'GorManager') || (fieldName === 'Manager')
|| (fieldName === 'Author') || (fieldName === 'ChiefDesigner') || (fieldName === 'ChiefDesignerAssistant'))) {
var that = this;
setTimeout(function() {
that.$scope.$apply(function() {
that.current[fieldName] = null;
});
}, 4);
}
return this.$q.resolve(res.message || null);
});
}
xeditable-autocomplete.js:
onshow: function () {
var that = this;
setTimeout(function () {
$(that.editorEl.find('select').getKendoComboBox().input).focus();
var oldValue = that.scope.$data;
that.editorEl.find('select').getKendoComboBox().bind('change', function (e) {
if (this.element.val()) {
that.scope.$data = this.dataItem() ? this.dataItem().Id : oldValue;
} else {
that.scope.$data = null;
}
});
that.editorEl.find('select').getKendoComboBox().bind('open', function (e) {
$('.k-popup').on('click', function (event) {
event.stopPropagation();
});
});
that.editorEl.find('select').getKendoComboBox().bind('filtering', function (e) {
var filter = e.filter;
if (!filter.value) {
e.preventDefault();
}
});
}, 4);
}
UPDATE: Solved. Added decision in a comment.
The code, that was returning options into select, was like this:
read: (options) => {
EmployeesService.getEmployees(options.data, currentEmployeeId).then((employees) => {
options.success(employees);
});
}
I added setTimeout and the code changed to this:
read: (options) => {
EmployeesService.getEmployees(options.data, currentEmployeeId).then((employees) => {
setTimeout(function() {
return options.success(employees);
}, 4);
});
}