Hello,
I have a combobox that I want to implement server filtering on - I have followed the example in the demo but I cannot get the filter to work, the items bind correctly upon selecting the dropdown but the autocomplete filter doesn't filter. The filter works perfectly clientside but not when I implement serverfiltering. Am I missing something on the controller end?
My View Code:
My Controller Code:
Thanks,
Carrie
I have a combobox that I want to implement server filtering on - I have followed the example in the demo but I cannot get the filter to work, the items bind correctly upon selecting the dropdown but the autocomplete filter doesn't filter. The filter works perfectly clientside but not when I implement serverfiltering. Am I missing something on the controller end?
My View Code:
@(Html.Kendo().ComboBoxFor(model => model.AffectedUser)
.Placeholder("Choose One...")
.DataTextField("Text")
.DataValueField("Value")
.Filter(FilterType.Contains)
.AutoBind(false)
.DataSource(dataSource => dataSource
.Read(read => read.Action("GetUserList", "User"))
.ServerFiltering(true)
))
public
class
UserController : Controller
{
public
JsonResult GetUserList(
string
group,
string
filter)
{
var items =
new
List<SelectListItem>();
for
(
int
i = 1; i <= 500; i++)
{
items.Add(
new
SelectListItem { Value = i.ToString(), Text =
"John"
});
}
items.Add(
new
SelectListItem { Value =
"Jane"
, Text =
"Jane"
});
return
Json(items.AsEnumerable(), JsonRequestBehavior.AllowGet);
}
}
Carrie