I'm using the Kendo UI autocomplete widget within a framework (not Kendo's MVVM framework). As such, I've defined a read function in the datasource configuration that returns my data, instead of using a string url reference. A snippet of my configuration is below:
transport: {
read: function (opts) {
console.log('arguments', arguments);
readFn(opts)
.then(opts.success)
.catch(e => opts.error([]));
}
}
My problem is that when I type into the autocomplete, the current text value of the autocomplete doesn't get passed to my custom read function. This means that I can't dynamically filter using the function. (I expected this to be passed as part of the opts
hash passed to the function.)
Kendo provides a serverFiltering
option, but this doesn't appear to do anything when using a custom function. So essentially, what this means - upon typing initially, Kendo will attempt to run the function, but then it will filter the data internally after that. That's not the behavior I'm looking for.
Is there a solution to this?
The problem was, of course, something that I was doing. I was indeed setting the serverFiltering
option, but I was passing it as part of the main options hash, not part of the Datasource. Changing this to be the correct way fixed the issue.