我已经实现了kendo组合框控件并尝试实现了filter选项。我正在显示的文本字段是连接字段。我有 设置以下属性,但过滤似乎不起作用。当用户键入前几个字符时,它应该过滤记录
.Filter("contains")
.ServerFiltering(true)
它对我的其他包含连接字段的组合框也不起作用。我错过了什么
<div class="col-md-4">
<div class="form-group">
@Html.LabelFor(model => model.Company, htmlAttributes: new { @class = "control-label col-md-4" })
<div class="col-md-8">
<div class="editor-field">
@(Html.Kendo().ComboBoxFor(model => model.CountryCode)
.HtmlAttributes(new { style = "width:100%" })
.DataTextField("CompanyCodeCompany")
.DataValueField("CountryCode")
.Filter("contains")
.MinLength(3)
.Events(e => e.DataBound("onCompanyComboChange"))
.Value(@user.DefaultCountryCode)
.DataSource(dataSource => dataSource
.Read(read => read.Action("RequestHeader_SalesOrganisation", "Request").Type(HttpVerbs.Post))
.ServerFiltering(true)
)
)
</div>
@Html.ValidationMessageFor(model => model.Company, "", new { @class = "text-danger" })
</div>
</div>
控制器
public ActionResult RequestHeader_SalesOrganisation()
{
var response = requestRepository.GetSalesOrganisation().AsQueryable().ProjectTo<SalesOrganisationViewModel>();
var jsonResult = Json(response, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;
}