Im using Ajax binding on a Autocomplete widget. The binding works fine the first time (at the first load of data), but if I back up over the value, it wont go back to the server again (it won't refresh it's dataSource items). How can I get the dataSource to refresh if I type a new string?
@(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"))
I think you want to set the ServerOperation
on the Datasource to true, like this:
.DataSource(dataSource => dataSource
.Read(read => read.Action("CustomerOrders", "Processing"))
.ServerOperation(true)
Since you provide your input text for the read then you have to set the ServerFiltering
( documentation ) for your datasource to true
in order to always filter from the server. I'm guessing that is the way that you want to handle it right? This will always trigger a server filtering though so if you have a lot of data it might be a good idea to set a MinLength for your requests for example 3-4 like this
.MinLength(4)
This way your datasource will read after the first 4 characters are typed and when you delete a character a dataSource.Read will be triggered too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.