Kendo ui 用户停止键入后Kendo UI MVC自动完成服务器筛选
我在asp.net mvc应用程序中使用Kendo UI autocomplete,Kendo autocomplete会在每个键上回调服务器方法,该键位于服务器请求上方。是否有任何方法可以使用autocomplete手动回调服务器以获取数据源 我的代码如下Kendo ui 用户停止键入后Kendo UI MVC自动完成服务器筛选,kendo-ui,kendo-asp.net-mvc,kendo-autocomplete,Kendo Ui,Kendo Asp.net Mvc,Kendo Autocomplete,我在asp.net mvc应用程序中使用Kendo UI autocomplete,Kendo autocomplete会在每个键上回调服务器方法,该键位于服务器请求上方。是否有任何方法可以使用autocomplete手动回调服务器以获取数据源 我的代码如下 @(Html.Kendo().AutoComplete() .Name("patientSearch") .DataTextField("patientSearch") .MinLength(2) .Placeholder("Se
@(Html.Kendo().AutoComplete()
.Name("patientSearch")
.DataTextField("patientSearch")
.MinLength(2)
.Placeholder("Search by Lastname, Firstname or DOB")
.HtmlAttributes(new { id = "textPatientSearch" })
.Template("<B>${data.LastName}, ${data.FirstName} </B> - ${ kendo.toString(kendo.parseDate(data.DateOfBirth),'MM/dd/yyyy') } ")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetFilteredPatient", "Order").Data("onAdditionalData");
})
.ServerFiltering(true);
}))
我不知道如何手动服务器筛选自动完成功能,请帮助。最后,我找到了解决方案,剑道UI提供了(默认值:200)方法,该方法接受以毫秒为单位的整数值,并在指定毫秒内等待上一次击键后的下一次用户击键,如果用户未能在指定的延迟时间内发送击键,剑道自动完成将自动触发服务器筛选
$(function(){
//setup before functions
var typingTimer; //timer identifier
var doneTypingInterval = 2000; //time in 3 ms
//on keyup, start the countdown
$('#textPatientSearch').keyup(function(e){
clearTimeout(typingTimer);
typingTimer = setTimeout(doneTyping, doneTypingInterval);
});
//on keydown, clear the countdown
$('#textPatientSearch').keydown(function(){
clearTimeout(typingTimer);
});
//user is "finished typing," do something
function doneTyping () {
**//WHAT TO DO HERE**
}
});