我在 Kendo UI ComboBox 中使用整数列表进行过滤时遇到问题。我使用整数列表作为数据源、StartsWith类型的过滤器和ServerFiltering(false)。
@(Html.Kendo().ComboBox().Placeholder("Jahr")
.IgnoreCase(true)
.Name("planungsZeiten")
.Filter(FilterType.StartsWith)
.DataSource(source => source.Read(read => read.Action("GetPlanungsZeiten", "Reweco"))
.ServerFiltering(false)))
public JsonResult GetPlanungsZeiten()
{
using (var repo = new ANECON_PDATAEntities())
{
return Json(repo.PlanungsZeiten.Select(j => j.Jahr).OrderByDescending(j => j).ToList(), JsonRequestBehavior.AllowGet);
}
}
当我在ComboBox中输入时,JavaScript抛出异常:
对象不支持属性或方法“toLowerCase”
发生这种情况是因为类型号不支持方法toLower。
我使用的版本是 2013.1.514,但最新版本 2014 Q1 SP1 (2014.1.416) 上的行为相同,如您在此处看到的:http://jsfiddle.net/akalcik/Fv8S5/1/
我已经尝试设置.IgnoreCase(true),但没有什么区别。是我哪里出了问题还是bug?
最佳答案
Startwith 不是整数类型的有效过滤器。您应该使用整数过滤器(等于、大于等),或者将基础源整数字段的类型更改为字符串以应用字符串过滤器。
关于javascript - 使用 ASP.NET MVC 中的 Kendo UI ComboBox 对数字数组进行过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23715598/