Hi, I identified that when using a data source with serverFiltering enabled, while the user is typing something in the input the list of items are being filtered as well, when for example just 2 items remains in the list and the user press the tab button or just click outside making the component loses its focus nothing is selected in the combo. I would like that when the list of items still is open and I loses its focus the first item is auto selected.
I ended up doing something like this:
I don't like the idead of having a setTimeout function to set the select item but when I simply set the select without using the setTimeout function it works but something triggered after the change/close events resets my alteration and the selectIndex becomes -1.
Any tips?
Thanks.
I ended up doing something like this:
widget._events.change.push(function (event) {
var minLength = $(element).attr("data-odata-minlength") || 2;
var value = widget.value().trim();
if (value != '' && value.length >= Number(minLength) && widget.dataItem() == undefined && widget._data().length > 0) {
var firstItem = widget._data()[0];
setTimeout(function () {
$.each(widget._data(), function (index, item) {
if (item.Id == firstItem.Id) {
widget.select(index);
return false;
}
});
}, 100);
}
});
Any tips?
Thanks.