[英]Autocomplete - How can I fire the server-side binding for the datasource after retyping the first few characters
我在自動完成小部件上使用Ajax綁定。 綁定在第一次(在第一次加載數據時)工作正常,但是如果我備份該值,它將不會再次返回到服務器(不會刷新其dataSource項)。 如果鍵入新的字符串,如何使dataSource刷新?
@(Html.Kendo().AutoComplete()
.Name("Orders")
.HtmlAttributes(new { style = "background-color:lightyellow;width:300px;" })
.Events(e =>
{
e.Select("selectOrder");
})
.Filter("startswith")
.Placeholder("Select order or enter new one")
.Filter("startswith")
.MinLength(3)
.DataSource(dataSource => dataSource
.Read(read => read.Action("CustomerOrders", "Processing")
.Type(HttpVerbs.Post).Data("getInputs"))).DataTextField("HouseNo"))
我認為您想將Datasource上的ServerOperation
設置為true,如下所示:
.DataSource(dataSource => dataSource
.Read(read => read.Action("CustomerOrders", "Processing"))
.ServerOperation(true)
由於您提供了讀取的輸入文本,因此必須將數據源的ServerFiltering
( 文檔 )設置為true
,以便始終從服務器進行過濾。 我猜這就是您要正確處理的方式嗎? 但是,這總是會觸發服務器過濾,因此,如果您有大量數據,最好為您的請求設置一個MinLength,例如3-4
.MinLength(4)
這樣,您的數據源將在鍵入前四個字符后讀取,而當您刪除一個字符時,也會觸發一個dataSource.Read。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.