I have a requirement where the user has to enter 3 letter and for each group of letters I have to display a different list. For instance if the user writes A I have to display AA, AB,... and if the user write AC I have to display ACA, ACB,...
I have configured the autocomplete with server filtering and if the user selects an item I need for the autocomplete to display a different list.
The autocomplete i like this
@(Html.Kendo().AutoCompleteFor(m => m.Field)
.DataTextField(
"Prefix"
)
.Filter(FilterType.StartsWith)
.MinLength(0)
// this does not work
.DataSource(dataSource => dataSource.Read(read => read.Action(
"GetClassifications"
,
"Device"
).Data(
"device.getFilterClassification"
))
.ServerFiltering(
true
))
.Template(
"<span class='k-state-default'>#: Prefix # - #: Name #</span>"
)
.Events(events => events.Select(
"classificationSelect"
))
)
and the script looks like this
function
classificationSelect(e) {
var
dataItem = e.sender.dataItem(e.item.index());
var
text = dataItem.Prefix;
if
(text.length < 3) {
e.sender.search(text);
}
}
The select method does not open the dropdownlist even though the server method is called with the correct selection. Sometimes it opens but with the old values.