I have service which give me top 10 records of result which is typed by user in search TextBox. So on keypress of textbox there is call of my service. Here i am using KendoUI AutoComplete so the problem is my service get call before autocomplete define. Can any one have idea?
<input data-bind="value: searchString, valueUpdate: 'afterkeydown'" placeholder="Search me.."/>
searchString: ko.computed({
read: function () { },
write: function (val) {
BindAutoTextBox(val);
return false;
}
}).extend({ throttle: 1000 }),
function BindAutoTextBox(val){
ServiceHelper.getData('search/users?SearchText='+val, function (data) {
$("#LeftSearch").kendoAutoComplete({
dataSource: {
data: data
},
dataTextField: "User_Code",
template: '<table width="100%"><tr><td width="20%" valign="top">#:User_Code#</td><td width="30%" valign="top">#:Full_Name#</td><td width="30%"
valign="top">#:Group_Name#</td></tr></table>'
});
var autoComplete = $("#LeftSearch").data("kendoAutoComplete");
// set width of the drop-down list
autoComplete.list.width(355);
}, null, 'http://abc/ApplicationRestService/', 'Users');
}
Can any one give me solution in brief detail code ?