I have a standard jquery kendo ui autocomplete, simple enough to initiate:
let querCo = [];
...........
$.each(lRsp, function(i, value) {
querCo.push(value[id]);
});
$("#agent").kendoAutoComplete({
dataSource: querCo,
serverFiltering: true, // this was also an attempt
select: function(e) {
let item = e.item;
text = item.text();
// console.log(text);
}
});
All is fine, except when trying to update it... for instance, I have a delete button, with a goal to delete the selected item; I get the selected item fine, and update the array at querCo
and remove that item from the array. But the autocomplete still shows it....
$('#del').click(function(){
let val = text;
querCo = $.grep(querCo, function(value) {
return value != val;
});
console.log(querCo); // correct, outputs updated array
Then I have tried both of the below; seemingly does nothing... original array, alas deleted item, still displays in auto complete?
attempt 1
$("#agent").data("kendoAutoComplete").dataSource.read();
attempt 2
$("#agent").data("kendoAutoComplete").refresh();
You can also try setting new data with
data
method:Dojo