Hello,
Now an experience with AutoComplete control.
There is this control, which has minLength = 3, and keyup event hits server to get data that is searched for. Now if the desired lookup for data is say 39015 which gets records that has a column with this value (from DB), so what a strange thing I observe is, when i start typing each char i.e. 3..9..0.1..5 one by one - it hits the server each time - the problem is :
- If the typing is slow as in wait for each server call to get completed, it shows up the popup.
- If typing in is arbitary, like slow or fast or a mix, say 39 and then 015, it doesn't show up the popup.
Although, the data being fetched is correct for all the inputs. But issue comes up with showing up the popup.
I read it over in one the forum threads, to use SEARCH() method- so what i did is : call the search method in change event, checking if number of items returned are > 0.
It resolves the problem but but it arises another problem - I see in debugger that it calls the datasource read method until a selection from popup is made, which is a big bash to performance. Is there a way to control it or any other clean way to just open the popup once data is fetched.
ko.bindingHandlers.kendoAutoComplete.init = function (element, params) {
////debugger;
var e = $(element);
var widget = e.data("kendoAutoComplete");
widget.dataSource.bind("change", function (d) {
//anytime the data source is updated, update the data pointer and the input
if (d.items) {
data = new kendo.data.ObservableArray(d.items).toJSON();
//Sometimes the dropdown isn't rendered - force it to show up/ search from the populated datasource of the autocomplete
if (d.items.length > 0) {
widget.search(d.items[0].CompanyName);
}
}
});
Now an experience with AutoComplete control.
There is this control, which has minLength = 3, and keyup event hits server to get data that is searched for. Now if the desired lookup for data is say 39015 which gets records that has a column with this value (from DB), so what a strange thing I observe is, when i start typing each char i.e. 3..9..0.1..5 one by one - it hits the server each time - the problem is :
- If the typing is slow as in wait for each server call to get completed, it shows up the popup.
- If typing in is arbitary, like slow or fast or a mix, say 39 and then 015, it doesn't show up the popup.
Although, the data being fetched is correct for all the inputs. But issue comes up with showing up the popup.
I read it over in one the forum threads, to use SEARCH() method- so what i did is : call the search method in change event, checking if number of items returned are > 0.
It resolves the problem but but it arises another problem - I see in debugger that it calls the datasource read method until a selection from popup is made, which is a big bash to performance. Is there a way to control it or any other clean way to just open the popup once data is fetched.
ko.bindingHandlers.kendoAutoComplete.init = function (element, params) {
////debugger;
var e = $(element);
var widget = e.data("kendoAutoComplete");
widget.dataSource.bind("change", function (d) {
//anytime the data source is updated, update the data pointer and the input
if (d.items) {
data = new kendo.data.ObservableArray(d.items).toJSON();
//Sometimes the dropdown isn't rendered - force it to show up/ search from the populated datasource of the autocomplete
if (d.items.length > 0) {
widget.search(d.items[0].CompanyName);
}
}
});