我目前在Kendo UI中遇到了一些問題。目前我有一個自動完成功能,我用它來獲得員工。我遇到的問題是我希望能夠使用多個詞(姓和名)來處理自動完成,例如'John Smith'。目前我的自動完成工作正常,如果輸入'john',它會在下面的下拉列表中顯示'John smith'以及包含單詞'john'的其他名稱。如果我輸入姓氏'史密斯'並且可以選擇'約翰史密斯',那麼同樣的作品可以。我想要做的是,當整個名字輸入'約翰史密斯'允許用戶選擇約翰史密斯,這意味着它仍然搜索這兩個詞。誰能幫忙?我將把我的代碼放在下面。Kendo UI自動完成,名稱搜索
謝謝。
//Autocomplete FeeEarner
$("#FeeEarnerEmailSend").kendoAutoComplete({
dataSource: new kendo.data.DataSource({
serverFiltering: true,
transport: {
read: "/" + prefix + "/api/Session/GetEmployees",
parameterMap: function() {
return { id: $("#FeeEarnerEmailSend").data("kendoAutoComplete").value() };
}
}
}),
dataTextField: 'FullName',
filter: "contains",
//placeholder: "Search...",
minLength: 3,
suggest: true,
select: function (e) {
var employeeAutoComplete = e.sender;
// this var is used in the Search button click event
selectedEmployeeDataItem = employeeAutoComplete.dataItem(e.item.index());
},
change: function() {
if ($.trim($("#FeeEarnerEmailSend").val()) == "") {
selectedEmployeeDataItem = null;
}
},
dataBound: function (e) {
selectedEmployeeDataItem = e.sender.dataItem(0);
}
});
刪除minLength:3並進行搜索 – 2014-11-21 10:01:55